vue实现省市区三级联动
npm 安装npm install v-distpicker --saveVue全局引入组件import Distpicker from 'v-distpicker'Vue.component('v-distpicker', Distpicker)也可以那里需要,哪里引入import VDistpicker from 'v-distpicker'expor...
·
npm 安装
npm install v-distpicker --save
Vue全局引入组件
import Distpicker from 'v-distpicker'
Vue.component('v-distpicker', Distpicker)
也可以那里需要,哪里引入
import VDistpicker from 'v-distpicker'
export default {
components: { VDistpicker }
}
<v-distpicker province="广东省" city="广州市" area="海珠区"></v-distpicker>
效果图:
关于取去 选中的值
这样:在声明vue实例的时候,定义 一个onSelected方法
<v-distpicker province="广东省" city="广州市" area="海珠区" @selected="onSelected"></v-distpicker>
onSelected(data) {
this.address.province = data.province.value
this.address.city = data.city.value
this.address.county = data.area.value
},
就可以 啦
更多推荐
已为社区贡献2条内容
所有评论(0)