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

虚拟滚动时,固定列阴影消失 #1116

Open
hairgc opened this issue May 8, 2024 · 2 comments
Open

虚拟滚动时,固定列阴影消失 #1116

hairgc opened this issue May 8, 2024 · 2 comments

Comments

@hairgc
Copy link

hairgc commented May 8, 2024

当开启虚拟滚动时,固定列为按照预期设置阴影效果

原因是虚拟滚动时,触发onInternalScroll事件时传入的currentTarget为virtuallist组件的ref,

table/src/Table.tsx

Lines 441 to 443 in f968c9e

const onInternalScroll = useEvent(
({ currentTarget, scrollLeft }: { currentTarget: HTMLElement; scrollLeft?: number }) => {
const isRTL = direction === 'rtl';

导致内部未正常获取到scrollWidth, clientWidth,拿到的是undefined

table/src/Table.tsx

Lines 457 to 465 in f968c9e

const measureTarget = currentTarget || scrollHeaderRef.current;
if (measureTarget) {
const { scrollWidth, clientWidth } = measureTarget;
// There is no space to scroll
if (scrollWidth === clientWidth) {
setPingedLeft(false);
setPingedRight(false);
return;
}

应当优化scrollWidth, clientWidth获取逻辑,虚拟滚动时可以优先从scrollHeaderRef.current获取

const measureTarget = currentTarget || scrollHeaderRef.current;

@linxianxi
Copy link
Contributor

看 antd 官网没问题啊,建议 issue 提到 antd 那边去并提供复现。一般不会关注这边的 issue。

@hairgc
Copy link
Author

hairgc commented May 17, 2024

看 antd 官网没问题啊,建议 issue 提到 antd 那边去并提供复现。一般不会关注这边的 issue。
官网就是有问题的,你进入到虚拟滚动demo,注意鼠标先不要在虚拟滚动列表滚动,直接把边框属性关掉

image

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