mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
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:
parent
3a60055f8e
commit
44194c711e
@ -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();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user