Browse Source

看地列表城市选择BUG修改

master
王健 4 years ago
parent
commit
6da20be7d4
  1. 21
      pages/look-list/look-list.js
  2. 2
      pages/look-list/look-list.wxml

21
pages/look-list/look-list.js

@ -182,17 +182,20 @@ Page({
}, },
bindMultiPickerColumnChange(e) { bindMultiPickerColumnChange(e) {
if (e.detail.column !== 0 || e.detail.value === 0) { if (e.detail.column === 0 && e.detail.value === 0) {
return
}
let city = this.data.multiRegion[e.detail.column][e.detail.value];
$api.getAreaList(city).then(res => {
let data = res.data
data.unshift('全部')
this.setData({ this.setData({
'multiRegion[1]': data 'multiRegion[1]': ['全部']
}) })
}) } else if (e.detail.column === 0){
let city = this.data.multiRegion[e.detail.column][e.detail.value];
$api.getAreaList(city).then(res => {
let data = res.data
data.unshift('全部')
this.setData({
'multiRegion[1]': data
})
})
}
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成

2
pages/look-list/look-list.wxml

@ -54,7 +54,7 @@
<view style="margin-left:30rpx" class="table-item center"> <view style="margin-left:30rpx" class="table-item center">
<picker class="flex_center flex_items" mode="multiSelector" range="{{multiRegion}}" <picker class="flex_center flex_items" mode="multiSelector" range="{{multiRegion}}"
value="{{multiIndex}}" bindchange="bindAddressChangeCity" bindcolumnchange="bindMultiPickerColumnChange"> value="{{multiIndex}}" bindchange="bindAddressChangeCity" bindcolumnchange="bindMultiPickerColumnChange">
<text>{{page.city}}{{page.canton?page.canton:'城市'}}</text> <text>{{page.city}}{{page.canton?page.canton:'全部'}}</text>
<image class="table-icon" src="../../assets/images/tab-icon.png"></image> <image class="table-icon" src="../../assets/images/tab-icon.png"></image>
</picker> </picker>
</view> </view>

Loading…
Cancel
Save