[youzan/vant-weapp]DateTimePicker在切换type后发生异常

2024-07-04 425 views
7

描述一下问题

我先是设置了选择器为date,弹出选择完关闭后又设置type为“year-month”,然后在滑动滚轮选择的时候发生如下异常。愿尽快修复,谢谢~

环境

  • 设备: IDE模拟工具
  • 基础库版本: 2.41
  • Vant Weapp 版本:vant-weapp-0.4.8

VM41449:1 thirdScriptError Cannot read property '5' of undefined; [Component] Event Handler Error @ src/components/vant/datetime-picker/index#onChange TypeError: Cannot read property '5' of undefined at http://127.0.0.1:45289/appservice/src/components/vant/datetime-picker/index.js:265:36 at Array.map () at V.onChange (http://127.0.0.1:45289/appservice/src/components/vant/datetime-picker/index.js:264:32) at Object.r.safeCallback (http://127.0.0.1:45289/appservice/__dev__/WAService.js:1:463149) at http://127.0.0.1:45289/appservice/__dev__/WAService.js:1:542632 at d (http://127.0.0.1:45289/appservice/__dev__/WAService.js:1:544835) at http://127.0.0.1:45289/appservice/__dev__/WAService.js:1:544147 at n (http://127.0.0.1:45289/appservice/__dev__/WAService.js:1:171394) at e (http://127.0.0.1:45289/appservice/appservice?t=1544098389944:7110:20307) at r.registerCallback.t (

回答

4

不复用就没有问题

8

尽量还是不要复用吧。 因为不同的type类型对应的value类型、最大最小可选值限制等都可能不同。 如果要变更type类型,相应传入的 value min-date max-date 等等属性也要对应修改,使用角度上来说是非常麻烦的。

1

了解了~ 谢谢 请把不要复用这一条更新到文档上吧,免得后面的人继续卡在这~