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
},

就可以 啦

Logo

前往低代码交流专区

更多推荐