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

无限滚动组件使用滚动条不能一直触发on-load #6133

Closed
5 tasks done
shilim-developer opened this issue Jul 11, 2024 · 2 comments · Fixed by #6137
Closed
5 tasks done

无限滚动组件使用滚动条不能一直触发on-load #6133

shilim-developer opened this issue Jul 11, 2024 · 2 comments · Fixed by #6137
Labels
untriaged need to sort

Comments

@shilim-developer
Copy link
Contributor

shilim-developer commented Jul 11, 2024

描述错误

无限滚动组件拖动滚动条到底部时,然后就无法再触发到底部了

复现步骤

使用滚动条拖动到底部,元素增加后,就不再继续出发加载了,使用文档的演示就可以复现

最小复现链接

https://www.naiveui.com/zh-CN/light/components/infinite-scroll

系统信息

System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1155G7 @ 2.50GHz
    Memory: 1.50 GB / 15.79 GB
Browsers:
    Edge: Chromium (126.0.2592.87)
    Internet Explorer: 11.0.22621.3527

使用的包管理器

npm

验证

@shilim-developer shilim-developer added the untriaged need to sort label Jul 11, 2024
@shilim-developer shilim-developer changed the title 无限滚动组件快速拖动滚动条到底部不会触发on-load 无限滚动组件使用滚动条不能一直触发on-load Jul 11, 2024
@shilim-developer
Copy link
Contributor Author

帮你发现问题了
https://github.com/tusen-ai/naive-ui/blob/main/src/_internal/scrollbar/src/Scrollbar.tsx#L432
https://github.com/tusen-ai/naive-ui/blob/main/src/infinite-scroll/src/InfiniteScroll.tsx#L31

handleCheckBottom检查是否在底部用的是scrollbar的containerScrollTop,但在scrollbar的回调中其实先触发onScroll事件再更新containerScrollTop的值,所以handleCheckBottom中拿到的containerScrollTop的值其实不是最新的

@CrassusX
Copy link

window.addEventListener('scroll', onScroll, true);

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

Successfully merging a pull request may close this issue.

2 participants