|
|
@ -84,7 +84,7 @@ |
|
|
|
this.handleDefaultRegion(region) |
|
|
|
this.handleDefaultRegion(region) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
|
|
console.log(region) |
|
|
|
// console.log(region) |
|
|
|
console.warn('defaultRegion非有效格式') |
|
|
|
console.warn('defaultRegion非有效格式') |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -150,7 +150,7 @@ |
|
|
|
this.$emit('getRegion',address) |
|
|
|
this.$emit('getRegion',address) |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleDefaultRegion(region){ |
|
|
|
handleDefaultRegion(region){ |
|
|
|
console.log(region,"region") |
|
|
|
// console.log(region,"region") |
|
|
|
const isCode = !Array.isArray(region) |
|
|
|
const isCode = !Array.isArray(region) |
|
|
|
this.isInitMultiArray = false; |
|
|
|
this.isInitMultiArray = false; |
|
|
|
let children = this.CHINA_REGIONS; |
|
|
|
let children = this.CHINA_REGIONS; |
|
|
@ -160,11 +160,11 @@ |
|
|
|
let condition; |
|
|
|
let condition; |
|
|
|
if(i==2){ |
|
|
|
if(i==2){ |
|
|
|
condition = isCode?String(children[j].code).slice(0)==region.slice(0):children[j].name.includes(region[i]); |
|
|
|
condition = isCode?String(children[j].code).slice(0)==region.slice(0):children[j].name.includes(region[i]); |
|
|
|
console.log(String(children[j].code).slice(0),region.slice(0)) |
|
|
|
// console.log(String(children[j].code).slice(0),region.slice(0)) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
condition = isCode?String(children[j].code).slice(0,(i+1)*2)==region.slice(0,(i+1)*2):children[j].name.includes(region[i]); |
|
|
|
condition = isCode?String(children[j].code).slice(0,(i+1)*2)==region.slice(0,(i+1)*2):children[j].name.includes(region[i]); |
|
|
|
// console.log(String(children[j].code).slice(0,(i+1)*2)==region.slice(0,(i+1)*2)) |
|
|
|
// console.log(String(children[j].code).slice(0,(i+1)*2)==region.slice(0,(i+1)*2)) |
|
|
|
console.log(String(children[j].code).slice(0,(i+1)*2),region.slice(0,(i+1)*2)) |
|
|
|
// console.log(String(children[j].code).slice(0,(i+1)*2),region.slice(0,(i+1)*2)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(condition){ |
|
|
|
if(condition){ |
|
|
@ -194,7 +194,7 @@ |
|
|
|
break; |
|
|
|
break; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
// 首次匹配失败就用默认的初始化 |
|
|
|
// 首次匹配失败就用默认的初始化 |
|
|
|
console.log(i,j,children.length-1,"匹配失败"); |
|
|
|
// console.log(i,j,children.length-1,"匹配失败"); |
|
|
|
if(i==0 && j==(children.length-1)){ |
|
|
|
if(i==0 && j==(children.length-1)){ |
|
|
|
this.isInitMultiArray = true; |
|
|
|
this.isInitMultiArray = true; |
|
|
|
} |
|
|
|
} |
|
|
|