fix(Area): When setting the attribute [columns-num=1 or columns-num=2] lower than the WeChat basic library version 2.7.7, the real machine environment reports an error (#3318)

This commit is contained in:
Wuli锤锤 2020-07-08 15:43:01 +08:00 committed by GitHub
parent 3a60055f8e
commit 44194c711e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,31 +201,34 @@ VantComponent({
} }
const stack = []; const stack = [];
const indexes = [];
stack.push(picker.setColumnValues(0, province, false)); if (this.data.columnsNum >= 1) {
stack.push(picker.setColumnValues(1, city, false)); stack.push(picker.setColumnValues(0, province, false));
indexes.push(this.getIndex('province', code));
if (city.length && code.slice(2, 4) === '00') {
[{ code }] = city;
} }
stack.push( if (this.data.columnsNum >= 2) {
picker.setColumnValues( stack.push(picker.setColumnValues(1, city, false));
2, indexes.push(this.getIndex('province', code));
this.getList('county', code.slice(0, 4)), if (city.length && code.slice(2, 4) === '00') {
false [{ code }] = city;
) }
); }
if (this.data.columnsNum === 3) {
stack.push(
picker.setColumnValues(
2,
this.getList('county', code.slice(0, 4)),
false
)
);
}
return Promise.all(stack) return Promise.all(stack)
.catch(() => {}) .catch(() => {})
.then(() => .then(() => picker.setIndexes(indexes))
picker.setIndexes([
this.getIndex('province', code),
this.getIndex('city', code),
this.getIndex('county', code),
])
)
.catch(() => {}); .catch(() => {});
}, },
@ -267,4 +270,4 @@ VantComponent({
return this.setValues(); return this.setValues();
}, },
}, },
}); });