KongDuo
xiaozhiyong 2 years ago
parent b9f6a1e3ed
commit 62a5e39390
  1. 33
      components/sl-filter/filter-view.vue

@ -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)

Loading…
Cancel
Save