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.
43 lines
1.2 KiB
43 lines
1.2 KiB
export default {
|
|
data() {
|
|
return {
|
|
provinceList: [], //省列表
|
|
cityList: [], //市列表
|
|
districtList: [], //区列表
|
|
|
|
}
|
|
},
|
|
created() {
|
|
this.getAreaData(undefined, 0)
|
|
},
|
|
methods: {
|
|
getAreaData(pid, i) {
|
|
if (i == 0) {
|
|
this.$axios
|
|
.post("/address/lists",)
|
|
.then(res => {
|
|
this.provinceList = res.data;
|
|
})
|
|
.catch(err => {
|
|
this.$message.error(err);
|
|
});
|
|
} else {
|
|
this.$axios
|
|
.post("/address/lists", {
|
|
pid
|
|
})
|
|
.then(res => {
|
|
if (i == 1) {
|
|
this.cityList = res.data;
|
|
}
|
|
if (i == 2) {
|
|
this.districtList = res.data;
|
|
}
|
|
})
|
|
.catch(err => {
|
|
this.$message.error(err);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|