[Doc] Picker: add demo of usage with popup

This commit is contained in:
陈嘉涵
2019-05-31 21:17:29 +08:00
parent 9a32a4a35d
commit 898ba11483
4 changed files with 141 additions and 3 deletions
+40
View File
@@ -75,6 +75,46 @@ export default {
};
```
### With Popup
```html
<van-field
readonly
clickable
label="City"
:value="value"
placeholder="Choose City"
@click="showPicker = true"
/>
<van-popup v-model="showPicker" position="bottom">
<van-picker
show-toolbar
:columns="columns"
@cancel="showPicker = false"
@confirm="onConfirm"
/>
</van-popup>
```
```js
export default {
data() {
return {
value: '',
showPicker: false,
columns: ['Delaware', 'Florida', 'Georqia', 'Indiana', 'Maine']
}
},
methods: {
onConfirm(value) {
this.value = value;
this.showPicker = false;
}
}
};
```
### Disable option
```html