-
Notifications
You must be signed in to change notification settings - Fork 305
[calendar] 日历组件带有switchMode时不能正确加载日历视图 #3455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
bug
Something isn't working
Comments
👋 @prprprPro,感谢给 TDesign 提出了 issue。 |
上面这个代码会导致没设置minDate时死循环,修改一下:
|
@prprprPro 请问是什么场景才会出现 “在页面加载完成后修改 minDate 或 maxDate,且value不在区间范围内”? |
@prprprPro 我大概懂你的点了,就是 value 不在 [minDate, maxDate] 区间范围时,期望日历仍能正常显示。我处理一下吧、 |
16 tasks
对的,因为默认value是当天,不在[minDate, maxDate]区间的情况很常见。那几个方法看的我有点头大...不提PR了还是交给你吧哈哈哈 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tdesign-miniprogram 版本
1.8.4
重现链接
No response
重现步骤
简单DEMO
在页面加载完成后修改minDate或maxDate,且当天不在区间范围内。
由于calendar.js line 197 calcCurrentMonth方法中,在newValue为null时会使用this.getCurrentDate()作为当前的日期值,该方法默认值为当天,此时如果正好设置了minDate或maxDate,且当天不在区间范围内,line 204设置的currentMonth会是一个空数组,会导致日期试图无法正常加载:
这个问题解决方法比较多,所以发个issue你们评估一下。一个可行的方法是在line 202后面判断一下是否空数组,如果是空数组的话用minDate刷新视图。
当然也可以修改getCurrentDate方法,增加一个判断value是否在minDate和maxDate之间的步骤,并对非法的value进行处理。就是不知道会不会对不设置switch-mode的时候产生影响。
期望结果
No response
实际结果
No response
基础库版本
No response
补充说明
No response
The text was updated successfully, but these errors were encountered: