picker选项跳跃问题?
发布于 6 年前 作者 yanshi 7786 次浏览 来自 官方Issues
<picker  mode="multiSelector" range="cityRange">
const { column, value } = e.mp.detail
 
if (colum === 1) {
try {
          const curCityCode1 = this.cityRange[1][value].areaCode
        } catch (error) {
          error.message = error.message + JSON.stringify({ 'province': this.cityRange[0][cityIndex[0]], value, curCityCode: this.cityRange[1] })
          throw error
        }
      }
}

选择后的代码报错日志

Cannot read property 'areaCode' of undefined{"province":{"areaCode":"220000","areaName":"重庆","aliV2AreaCode":"500000","parentArea":""},"value":17,"curCityCode":[{"areaCode":"222200","areaName":"重庆市","aliV2AreaCode":"500100","parentArea":"220000"},{"areaCode":"222300","areaName":"重庆郊县","aliV2AreaCode":"500200","parentArea":"220000"}]}; [Component] Event Handler Error @ pages/soleProInfosConfirm/main#bound handleProxy
{"province":{"areaCode":"220000","areaName":"重庆","aliV2AreaCode":"500000","parentArea":""},"value":17,"curCityCode":[{"areaCode":"222200","areaName":"重庆市","aliV2AreaCode":"500100","parentArea":"220000"},{"areaCode":"222300","areaName":"重庆郊县","aliV2AreaCode":"500200","parentArea":"220000"}]}

报错打印出来的value竟然是17,我第二个选择是curCityCode: this.cityRange[1],

[{“areaCode”:“222200”,“areaName”:“重庆市”,“aliV2AreaCode”:“500100”,“parentArea”:“220000”},{“areaCode”:“222300”,“areaName”:“重庆郊县”,“aliV2AreaCode”:“500200”,“parentArea”:“220000”}]

只有2个选项,为什么会出现17

只有部分手机会,测试环境几部手机都没测出问题来,个别用户就报

回到顶部