如何安装
npm install v-distpicker --save
或者
yarn add v-distpicker --save
注册全局组件
import VDistpicker from 'v-distpicker'
Vue.component('v-distpicker', VDistpicker)
注册局部组件
import VDistpicker from 'v-distpicker'
export default {
components: { VDistpicker }
}
基本使用
import VDistpicker from 'v-distpicker'
export default {
components: { VDistpicker },
}
占位符
import VDistpicker from 'v-distpicker'
export default {
components: { VDistpicker },
data() {
return {
placeholders: {
province: '------- 省 --------',
city: '--- 市 ---',
area: '--- 区 ---',
}
}
}
}
原始值
import VDistpicker from 'v-distpicker'
export default {
components: { VDistpicker },
data() {
return {
select: { province: '广东省', city: '广州市', area: '海珠区' },
}
},
}
隐藏区
import VDistpicker from 'v-distpicker'
export default {
components: { VDistpicker },
}
只有省
import VDistpicker from 'v-distpicker'
export default {
components: { VDistpicker },
}
事件触发
import VDistpicker from 'v-distpicker'
export default {
components: { VDistpicker },
methods: {
onSelected(data) {
alert(data.province + ' | ' + data.city + ' | ' + data.area)
console.log(data)
},
}
}
领取专属 10元无门槛券
私享最新 技术干货