docs(Form): add Picker demo

This commit is contained in:
陈嘉涵
2020-02-11 11:33:26 +08:00
parent de5dfe9211
commit 3f33b6de47
5 changed files with 175 additions and 14 deletions
+43
View File
@@ -195,6 +195,49 @@ export default {
};
```
### Field Type - Picker
```html
<van-field
readonly
clickable
name="picker"
:value="value"
label="Picker"
placeholder="Picker"
@click="showPicker = true"
/>
<van-popup v-model="showPicker" position="bottom">
<van-picker
show-toolbar
:columns="columns"
@confirm="onConfirm"
@cancel="onCancel"
/>
</van-popup>
```
```js
export default {
data() {
return {
value: '',
columns: ['Delaware', 'Florida', 'Georqia', 'Indiana', 'Maine'],
showPicker: false,
};
},
methods: {
onConfirm(value) {
this.value = value;
this.showPicker = false;
},
onCancel() {
this.showPicker = false;
},
},
};
```
## API
### Props