-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(CanlendarPicker): component freezes when the time interval is too… #6766
base: master
Are you sure you want to change the base?
Conversation
@@ -71,6 +71,8 @@ | |||
"rc-util": "^5.38.1", | |||
"react-fast-compare": "^3.2.2", | |||
"react-is": "^18.2.0", | |||
"react-virtualized-auto-sizer": "^1.0.24", | |||
"react-window": "^1.8.10", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看看能否使用 rc-virtual-list
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外,package lock 文件删一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外,package lock 文件删一下
好的收到 我尝试下 rc-virtual-list
// 遍历月份 | ||
const totalMonths = Math.ceil(maxDay.diff(minDay, 'months', true)) | ||
// default 每个月的高度是 344px | ||
const monthHeight = 344 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个不一定的,如果 css var 改了会变
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG 那改怎么修改, 虚拟滚动需要一个定高才行 o(╥﹏╥)o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦我鸡道了,我这个变量初始是 344,然后初始化的时候统计计算一下用户设置的高度,再修改这个 monthHeight 的值,我还注意到renderDate这个 props 也会影响到高度,所以写死是不 ok 的,我尝试改一下
… large, using virtual scrolling optimization
8a3afca
to
b8a572a
Compare
@zombieJ 大佬我搞了个新版本解决用户自定义日历的话高度不可以固定写死值,整理了下之前的代码逻辑。思路是renderPlaceholderMonths 创建的 dom 放在组件里,然后获取到可被内容撑开 的 dom 元素,获取到他的高度也就是用户自定义后的高度后再告诉虚拟滚动 List 使用这个高度,测试方式我用src/components/calendar-picker/demos/demo3.less:91 文件修改了 height |
69f1aed
to
99bb852
Compare
component freezes when the time interval is too large, using virtual scrolling optimization
#6710 尝试修复此问题,使用了虚拟滚动避免 dom 数量过多引起的卡顿