|
|
|
@ -48,17 +48,21 @@ |
|
|
|
|
<picker-view :value="region" @change="bindChange"> |
|
|
|
|
<picker-view-column> |
|
|
|
|
<view class="center" v-for="(item, index) in areaCodeList" :key="index"> |
|
|
|
|
{{ item.areaName }} |
|
|
|
|
<!-- v-show不可去除 去掉会显示undefined 原因未知 --> |
|
|
|
|
<view v-show="false">{{ JSON.stringify(item.areaName) }}</view> |
|
|
|
|
{{item.areaName}} |
|
|
|
|
</view> |
|
|
|
|
</picker-view-column> |
|
|
|
|
<picker-view-column v-if="areaCodeList[areaIndex[0]]"> |
|
|
|
|
<view class="center" v-for="(item, index) in areaCodeList[areaIndex[0]].childList" :key="index"> |
|
|
|
|
<view v-show="false">{{ JSON.stringify(item.areaName) }}</view> |
|
|
|
|
{{ item.areaName }} |
|
|
|
|
</view> |
|
|
|
|
</picker-view-column> |
|
|
|
|
<picker-view-column v-if="areaCodeList[areaIndex[0]]"> |
|
|
|
|
<view class="center" |
|
|
|
|
v-for="(item, index) in areaCodeList[areaIndex[0]].childList[areaIndex[1]].childList" :key="index"> |
|
|
|
|
<view v-show="false">{{ JSON.stringify(item.areaName) }}</view> |
|
|
|
|
{{ item.areaName }} |
|
|
|
|
</view> |
|
|
|
|
</picker-view-column> |
|
|
|
@ -165,7 +169,7 @@ |
|
|
|
|
} |
|
|
|
|
// this.areaCodeList = this.areaCodeList1 |
|
|
|
|
console.log(this.areaCodeList,this.areaCodeList1,'11111111111111') |
|
|
|
|
this.areaCodeList.unshift({areaName:'全部'}) |
|
|
|
|
this.areaCodeList.unshift({areaName:'全部',childList:[{areaName:'',childList:[{areaName:''}]}]}) |
|
|
|
|
},3000) |
|
|
|
|
console.log('%c 子组件参数↓','font-size:30px;color:red') |
|
|
|
|
}, |
|
|
|
@ -213,17 +217,24 @@ |
|
|
|
|
} |
|
|
|
|
if(!ccc){ |
|
|
|
|
// 数组push‘全部’ |
|
|
|
|
if(this.areaCodeList[val[0]].childList[0].areaName != '全部'){ |
|
|
|
|
this.areaCodeList[val[0]].childList.unshift({areaName:'全部'}) |
|
|
|
|
} |
|
|
|
|
if(this.areaIndex[1]!=0){ |
|
|
|
|
if(this.areaCodeList[val[0]].childList[val[1]].childList[0].areaName != '全部'){ |
|
|
|
|
this.areaCodeList[val[0]].childList[val[1]].childList.unshift({areaName:'全部'}) |
|
|
|
|
if(val[0] != 0) { |
|
|
|
|
if(this.areaCodeList[val[0]].childList[0].areaName != '全部'){ |
|
|
|
|
this.areaCodeList[val[0]].childList.unshift({areaName:'全部'}) |
|
|
|
|
} |
|
|
|
|
if(this.areaIndex[1]!=0){ |
|
|
|
|
if(this.areaCodeList[val[0]].childList[val[1]].childList[0].areaName != '全部'){ |
|
|
|
|
this.areaCodeList[val[0]].childList[val[1]].childList.unshift({areaName:'全部'}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.provinceCode = this.areaCodeList[this.areaIndex[0]].id |
|
|
|
|
this.cityCode = this.areaCodeList[this.areaIndex[0]].childList[this.areaIndex[1]].id |
|
|
|
|
this.areaCode = this.areaCodeList[this.areaIndex[0]].childList[this.areaIndex[1]].childList[this.areaIndex[2]].id |
|
|
|
|
}else { |
|
|
|
|
this.provinceCode = this.cityCode =this.areaCode = '' |
|
|
|
|
this.areaIndex = [0,0,0] |
|
|
|
|
} |
|
|
|
|
this.provinceCode = this.areaCodeList[this.areaIndex[0]].id |
|
|
|
|
this.cityCode = this.areaCodeList[this.areaIndex[0]].childList[this.areaIndex[1]].id |
|
|
|
|
this.areaCode = this.areaCodeList[this.areaIndex[0]].childList[this.areaIndex[1]].childList[this.areaIndex[2]].id |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.$emit('changeArea',e) |
|
|
|
|