收藏
回答

滚动选择器,做完联动后,无法滚动选择了

问题模块
API和组件

以下是我的代码

.wxml

<picker mode='multiSelector' range='{{multiRangeO}}' range-key='name' bindchange='multiPickerAOChange' bindcolumnchange='multiPickerAOColumnChange'>省市县联动</picker>

.js


data: {

multiRangeO: []

}


onLoad: function (options) {

this.setData({

multiRangeO: [[{ id: 0, name: '北京' }, { id: 1, name: '上海' }, { id: 2, name: '天津' }, { id: 3, name: '重庆' }], [{ id: 0, name: '北京' }], [{ id: 0, name: '朝阳区' }, { id: 1, name: '海淀区' }, { id: 2, name: '东城区' }, { id: 3, name: '西城区' }]]

})

}


multiPickerAOColumnChange: function (e) {

console.log(e)

var multiRangeO = this.data.multiRangeO

switch (e.detail.column) {

case 0:

switch (e.detail.value) {

case 0:

multiRangeO.splice(1, 1, [{ id: 0, name: '北京' }])

multiRangeO.splice(2, 1, [{ id: 0, name: '朝阳区' }, { id: 1, name: '海淀区' }, { id: 2, name: '东城区' }, { id: 3, name: '西城区' }])

this.setData({

multiRangeO: multiRangeO

})

console.log(this.data.multiRangeO)

break

case 1:

multiRangeO.splice(1, 1, [{ id: 0, name: '上海' }])

multiRangeO.splice(2, 1, [{ id: 4, name: '徐汇区' }, { id: 5, name: '长宁区' }, { id: 6, name: '静安区' }, { id: 7, name: '闸北区' }])

this.setData({

multiRangeO: multiRangeO

})

console.log(this.data.multiRangeO)

break

case 2:

multiRangeO.splice(1, 1, [{ id: 0, name: '天津' }])

multiRangeO.splice(2, 1, [{ id: 8, name: '东丽区' }, { id: 9, name: '和平区' }, { id: 10, name: '河北区' }, { id: 11, name: '河东区' }])

this.setData({

multiRangeO: multiRangeO

})

console.log(this.data.multiRangeO)

break

case 3:

multiRangeO.splice(1, 1, [{ id: 0, name: '重庆' }])

multiRangeO.splice(2, 1, [{ id: 12, name: '万州区' }, { id: 13, name: '涪陵区' }, { id: 14, name: '梁平县' }, { id: 15, name: '南川区' }])

this.setData({

multiRangeO: multiRangeO

})

console.log(this.data.multiRangeO)

break

}

break

}

}

联动效果实现了,但是第二列和第三列无法滚动了,点击确定后e.detail.value=[1,null,null],如下图,求大神指教


最后一次编辑于  2017-11-22  (未经腾讯允许,不得转载)
回答关注问题邀请回答
收藏

1 个回答

  • 杨毅
    杨毅
    2017-11-22

    求大神们帮忙看看

    2017-11-22
    赞同
    回复