-
Notifications
You must be signed in to change notification settings - Fork 543
fix(table): prevent scroll to top when expand table #5069
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
base: develop
Are you sure you want to change the base?
Conversation
const refreshVirtualScroll = ([{ contentRect }]: [ResizeObserverEntry]) => {
// 如果宽度发生变化,重置滚动位置
if (params.value.preventResizeRefresh) return;
const maxScrollbarWidth = 16;
if (Math.abs(contentRect.width - containerWidth.value) > maxScrollbarWidth && !!container.value) {
container.value.scrollTop = 0;
translateY.value = 0;
}
containerWidth.value = contentRect.width;
// 高度更新后,由 height 独立的 watch 触发可视区域的更新
containerHeight.value = contentRect.height;
}; |
TDesign Component Site Preview Open
|
@chaishi cc |
commit: |
之前重构这个hook的时候,看到这里的判断,推测这里的思路是,宽度改变,影响元素高度,这时候虚拟滚动的高度缓存将不再可靠,所以将滚动高度也重置会0了? |
感觉没必要 |
🤔 这个 PR 的性质是?
🔗 相关 Issue
#5052
💡 需求背景和解决方案
📝 更新日志
fix(table): prevent scroll to top when expand table
本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单