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