使用方式
在 script 中引用组件
import selectAddress from '@/components/yixuan-selectAddress/yixuan-selectAddress.vue'
export default {
components: {selectAddress}
}
在 template 中使用组件
<button type="primary" @click="btnClick">选择地址</button>
<selectAddress ref='selectAddress' @selectAddress="successSelectAddress"></selectAddress>
export default {
methods: {
btnClick() {
this.$refs.selectAddress.show()
},
successSelectAddress(address){ //选择成功回调
console.log(address)
}
}
}
仿京东地址选择插件:https://ext.dcloud.net.cn/plugin?id=1297

网友评论