You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
906 B
53 lines
906 B
<template>
|
|
<uni-data-picker @change="$emit('change', $event)" :localdata="cityData" v-model="address" ref="picker" ></uni-data-picker>
|
|
</template>
|
|
|
|
<script>
|
|
import { getAddressData } from "@/utils/address";
|
|
|
|
export default {
|
|
props: {
|
|
address: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
cityData: []
|
|
};
|
|
},
|
|
created() {
|
|
this.getAddressData();
|
|
},
|
|
methods: {
|
|
show() {
|
|
this.$refs.picker.show();
|
|
},
|
|
async getAddressData() {
|
|
try {
|
|
const res = await getAddressData();
|
|
this.cityData = res;
|
|
} catch (err) {
|
|
this.$util.showMsg("获取地址数据失败!");
|
|
}
|
|
},
|
|
},
|
|
|
|
// #ifdef MP
|
|
options: {
|
|
styleIsolation: "shared",
|
|
},
|
|
// #endif
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
/deep/ .uni-data-tree-input {
|
|
display: none;
|
|
}
|
|
|
|
/deep/ .uni-data-tree {
|
|
flex: 0;
|
|
}
|
|
</style>
|
|
|