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.
zhishifufei_uniapp/components/AddressPicker/index.vue

55 lines
928 B

10 months ago
<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();
10 months ago
console.log(res);
10 months ago
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>