mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] AddressEdit: optimzie area select (#1877)
This commit is contained in:
parent
5224684bb2
commit
69151078cc
@ -182,8 +182,8 @@ export default create({
|
|||||||
|
|
||||||
areaText() {
|
areaText() {
|
||||||
const { province, city, county, areaCode } = this.data;
|
const { province, city, county, areaCode } = this.data;
|
||||||
if (province && city && county && areaCode) {
|
if (areaCode) {
|
||||||
const arr = [province, city, county];
|
const arr = [province, city, county].filter(text => text);
|
||||||
if (province === city) {
|
if (province === city) {
|
||||||
arr.shift();
|
arr.shift();
|
||||||
}
|
}
|
||||||
@ -225,8 +225,9 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onAreaConfirm(values) {
|
onAreaConfirm(values) {
|
||||||
|
const areaCode = (values[2] || values[1] || values[0]).code;
|
||||||
this.showAreaPopup = false;
|
this.showAreaPopup = false;
|
||||||
this.data.areaCode = values[2].code;
|
this.data.areaCode = areaCode;
|
||||||
this.assignAreaValues(values);
|
this.assignAreaValues(values);
|
||||||
this.$emit('change-area', values);
|
this.$emit('change-area', values);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user