From 58e5a7a537ef921ab8d05720585e9d72c4aab74b Mon Sep 17 00:00:00 2001 From: penguin_island_owner <2650744390@qq.com> Date: Sun, 8 Sep 2024 15:23:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(list):=20=E6=8B=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=BD=AE=E9=A1=B6=E6=97=B6=E8=BF=BD=E5=8A=A0=E7=A9=BA=E5=80=BC?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useVirtualScrollNew.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useVirtualScrollNew.ts b/src/hooks/useVirtualScrollNew.ts index afb98b1d68..4ca901f219 100644 --- a/src/hooks/useVirtualScrollNew.ts +++ b/src/hooks/useVirtualScrollNew.ts @@ -171,7 +171,7 @@ const useVirtualScroll = (container: Ref, 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; }