Skip to content
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

鼠标拖动滚动条时错位 #9

Closed
qishibo opened this issue Jan 13, 2023 · 4 comments
Closed

鼠标拖动滚动条时错位 #9

qishibo opened this issue Jan 13, 2023 · 4 comments

Comments

@qishibo
Copy link

qishibo commented Jan 13, 2023

https://xiaocheng555.github.io/el-table-virtual-scroll/#/SortDemo?code=SortDemo&codeTitle=%E6%8E%92%E5%BA%8F
看的是这个demo,发现拖动滚动条时会出现错位现象,逐渐变大的那种,这种正常么

@qishibo
Copy link
Author

qishibo commented Jan 13, 2023

指的是滑块和鼠标之间的错位

@xiaocheng555
Copy link
Owner

https://xiaocheng555.github.io/el-table-virtual-scroll/#/SortDemo?code=SortDemo&codeTitle=%E6%8E%92%E5%BA%8F 看的是这个demo,发现拖动滚动条时会出现错位现象,逐渐变大的那种,这种正常么

image

item-size设置了估计行高为62,但是实际行高是71,而滚动容器是由 2000 * 62(行数 * 行高) 撑起滚动内容高度的,而实际上虚拟滚动会更新实际每行的高度也就是71,导致滚动容器滚动内容高度越来越大于 2000 * 62并慢慢地变为 2000 * 71,所以容器每次滚动都会让容器滚动内容高度变大,是的滚动条错位。

只要将item-size 设置为 71就好了
image

@xiaocheng555
Copy link
Owner

demo 已经更新,如果页面有缓存记得清一下缓存再看效果,排序源码这里是设置为item-size为71的
image

@qishibo
Copy link
Author

qishibo commented Jan 13, 2023

赞,好使了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants