mand-mobile/components/tab-picker
xuxiaoyan c39727fb0a test: update mand-mobile introduction 2018-12-21 18:18:05 +08:00
..
demo example: update demos 2018-12-06 16:24:19 +08:00
test test: update mand-mobile introduction 2018-12-21 18:18:05 +08:00
README.en-US.md doc: update readme example link 2018-12-18 16:06:20 +08:00
README.md doc: update readme example link 2018-12-18 16:06:20 +08:00
component.js feat(code clean up): 2018-09-24 15:48:57 +08:00
index.vue fix(popup, picker, date-picker, tab-picker, selector, cashier): extract props to mixins 2018-12-12 14:11:25 +08:00

README.en-US.md

title preview
TabPicker https://mand-mobile.github.io/2x-doc/examples/#/tab-picker

Support cascaded selections in the footer

Import

import { TabPicker } from 'mand-mobile'

Vue.component(TabPicker.name, TabPicker)

Code Examples

API

TabPicker Props

Props Description Type Default Note
v-model whether to show tabpicker or not Boolean false -
default-value default values Array [] -
data data source Array [] refer to Appendix for data format
title the title of tabpicker String - -
describe the describe of tabpicker String - -
placeholder default label for each tab pane String 请选择 -
mask-closable if the popup will be closed when clicking on the mask Boolean true -

TabPicker Methods

getSelectedValues()

Get all values of selected items

['value1', 'value2', 'value3']

getSelectedOptions()

Get all options of selected items

[
  { value: 'value1', label: 'Item1' },
  { value: 'value2', label: 'Item2' },
  // ...
]

TabPicker Events

@change(data)

Change selection in the tabpicker

// data object
{
  values: ['value1', 'value2', 'value3'],
  options: [
    { value: 'value1', label: 'Item1' },
    { value: 'value2', label: 'Item2' },
    // ...
  ]
}
@show()

Show tabPicker

@hide()

Hide tabPicker

TabPicker Slots

Custom option item slot

<md-tab-picker>
  <div slot="item" scoped-slot="{ option }">
    Hello, {{option.label}}
  </div>
</md-tab-picker>

Appendix

  • Data format of cascaded data source
{
  // unique key
  name: '',
  // pane title
  label: '',
  // pane options
  options: [
    {
      // option value
      value: "",
      // option label
      label: "",
      // cascade pane
      children: {
        name: '',
        label: '',
        options: [
          // ...
        ]
      }
    }
  ]
}