mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Area): use first city code when county list is empty (#6356)
This commit is contained in:
parent
5d8ca5a531
commit
6a2a0cc5c6
@ -197,17 +197,29 @@ export default createComponent({
|
|||||||
this.$emit('confirm', values, index);
|
this.$emit('confirm', values, index);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDefaultCode() {
|
||||||
|
if (this.columnsPlaceholder.length) {
|
||||||
|
return PLACEHOLDER_CODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const countyCodes = Object.keys(this.county);
|
||||||
|
if (countyCodes[0]) {
|
||||||
|
return countyCodes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
const cityCodes = Object.keys(this.city);
|
||||||
|
if (cityCodes[0]) {
|
||||||
|
return cityCodes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
|
||||||
setValues() {
|
setValues() {
|
||||||
let { code } = this;
|
let { code } = this;
|
||||||
|
|
||||||
if (!code) {
|
if (!code) {
|
||||||
if (this.columnsPlaceholder.length) {
|
code = this.getDefaultCode();
|
||||||
code = PLACEHOLDER_CODE;
|
|
||||||
} else if (Object.keys(this.county)[0]) {
|
|
||||||
code = Object.keys(this.county)[0];
|
|
||||||
} else {
|
|
||||||
code = '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { picker } = this.$refs;
|
const { picker } = this.$refs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user