第一步自然是安装

        npm install v-distpicker --save

test.vue

        import VDistpicker from 'v-distpicker'


export default {
 components: { VDistpicker }

}


        <v-distpicker></v-distpicker>

写到这里效果就已经出来了,简单吧

 接下来介绍一下常用配饰项

默认地址:

        <v-distpicker province="广东省" city="广州市" area="海珠区"></v-distpicker>

手机样式

        <v-distpicker type="mobile"></v-distpicker>

最重要的获取选中的值,这一步找了很久才找到,官网和github上都没找到介绍

        <v-distpicker type="mobile" @selected="onSelected"></v-distpicker>

onSelected:function(data){
this.$store.state.citydata = data.province.value + data.city.value + data.area.value
console.log(this.$store.state.citydata)
}

Logo

前往低代码交流专区

更多推荐