feat(Cascader): add events

This commit is contained in:
chenjiahan
2020-12-20 21:23:50 +08:00
committed by neverland
parent 3f429142ac
commit 95cae6021c
3 changed files with 73 additions and 41 deletions
+16 -4
View File
@@ -5,14 +5,16 @@
is-link
readonly
:label="t('area')"
:value="base.value"
:placeholder="t('selectArea')"
@click="showBase = true"
@click="base.show = true"
/>
<van-popup v-model="showBase" round position="bottom">
<van-popup v-model="base.show" round position="bottom">
<van-cascader
:title="t('selectArea')"
:options="t('options')"
@close="showBase = false"
@close="base.show = false"
@finish="onFinish"
/>
</van-popup>
</demo-block>
@@ -37,8 +39,18 @@ export default {
data() {
return {
showBase: false,
base: {
show: false,
value: '',
},
};
},
methods: {
onFinish({ selectedOptions }) {
this.base.show = false;
this.base.value = selectedOptions.map((option) => option.text).join('/');
},
},
};
</script>