[improvement] AddressEdit: optimzie area select (#1877)

This commit is contained in:
neverland 2018-09-30 11:35:40 +08:00 committed by GitHub
parent 5224684bb2
commit 69151078cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}, },