[new feature] Picker: add default-index prop (#2935)

This commit is contained in:
neverland
2019-03-10 17:22:31 +08:00
committed by GitHub
parent cca584e9d5
commit cb72fef807
5 changed files with 101 additions and 42 deletions
+27 -16
View File
@@ -31,24 +31,14 @@ export default {
};
```
#### Disable option
#### Default Index
```html
<van-picker :columns="columns" />
```
```javascript
export default {
data() {
return {
columns: [
{ text: 'Delaware', disabled: true },
{ text: 'Florida' },
{ text: 'Georqia' }
]
};
}
};
<van-picker
:columns="columns"
:default-index="2"
@change="onChange"
/>
```
#### Show Toolbar
@@ -81,6 +71,26 @@ export default {
};
```
#### Disable option
```html
<van-picker :columns="columns" />
```
```javascript
export default {
data() {
return {
columns: [
{ text: 'Delaware', disabled: true },
{ text: 'Florida' },
{ text: 'Georqia' }
]
};
}
};
```
#### Multi columns
```html
@@ -137,6 +147,7 @@ When Picker columns data is acquired asynchronously, use `loading` prop to show
| confirm-button-text | Text of confirm button | `String` | `Confirm` |
| cancel-button-text | Text of cancel button | `String` | `Cancel` |
| visible-item-count | Count of visible columns | `Number` | `5` |
| default-index | Default value index of single column picker | `Number` | `0` |
### Event
Picker events will pass different parameters according to the columns are single or multiple