docs(Form): add Area demo

This commit is contained in:
陈嘉涵
2020-02-11 15:24:09 +08:00
parent ed16eb7a59
commit fb3892e302
6 changed files with 159 additions and 5 deletions
+44 -2
View File
@@ -244,9 +244,9 @@ export default {
<van-field
readonly
clickable
name="picker"
name="datetimePicker"
:value="value"
label="DatetimePicker"
label="Datetime Picker"
placeholder="Select time"
@click="showPicker = true"
/>
@@ -284,6 +284,48 @@ export default {
};
```
### Field Type - Area
```html
<van-field
readonly
clickable
name="area"
:value="value"
label="Area Picker"
placeholder="Select area"
@click="showArea = true"
/>
<van-popup v-model="showArea" position="bottom">
<van-area
:area-list="areaList"
@confirm="onConfirm"
@cancel="onCancel"
/>
</van-popup>
```
```js
export default {
data() {
return {
value: '',
showArea: false,
areaList: {}
};
},
methods: {
onConfirm(values) {
this.value = values.map(item => item.name).join('/');
this.showArea = false;
},
onCancel() {
this.showArea = false;
},
},
};
```
## API
### Props