Skip to content

Commit

Permalink
fix(list): 拟列表置顶时追加空值判断 (#4541)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengchengshi committed Sep 8, 2024
1 parent addc8b8 commit 2571ba6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/useVirtualScrollNew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const useVirtualScroll = (container: Ref<HTMLElement | null>, params: UseVirtual
const refreshVirtualScroll = ([{ contentRect }]: [ResizeObserverEntry]) => {
// 如果宽度发生变化,重置滚动位置
const maxScrollbarWidth = 16;
if (Math.abs(contentRect.width - containerWidth.value) > maxScrollbarWidth) {
if (Math.abs(contentRect.width - containerWidth.value) > maxScrollbarWidth && !!container.value) {
container.value.scrollTop = 0;
translateY.value = 0;
}
Expand Down

0 comments on commit 2571ba6

Please sign in to comment.