收藏
回答

多列选择器监听取消选择重新赋值bug?

操作代码:

//列发生改变时
deliveryColumnChange: function(e) {
    var value = e.detail.value;
    var carrier = this.data.carrierList;
    var carrierSelect = this.data.carrierSelect;
    carrierSelect[e.detail.column] = value;

    switch (e.detail.column) {
      case 0:
        carrierSelect[0] = value;
        carrier[1] = this.data.carrierArray[value];
        break;
      case 1:
        carrierSelect[1] = value;
        break;
    }

    this.setData({
      carrierList: carrier,
      carrierSelect: carrierSelect
    });
},

//确定
deliveryChange: function (e) {
    var value = e.detail.value;
    
    this.setData({
      carrierSelect: value,
      carrierSelected: value,
    });
},

//取消
cancelDelivery: function(e){
    var carrier = this.data.carrierList;
    var carrierSelected = this.data.carrierSelected;
    carrier[1] = this.data.carrierArray[carrierSelected[0]][carrierSelected[1]];
    this.setData({
      carrierSelected: carrierSelected,
      carrierSelect: carrierSelected,
      carrierList: carrier,
    })
},


点击取消后再次点开选择器,如下图

列表数据都正常,但是选择器里没有渲染出来,是我代码有问题还是小程序组件的bug,麻烦大佬们解答一下,谢谢。

补充:代码片段:https://developers.weixin.qq.com/s/sosmBTmr7Uj7

基础库版本:2.12.1

微信开发者工具 1.03.2006090

最后一次编辑于  2020-08-26
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签