From 2571ba687ac6b448cdd8f6c596c20689cbcea651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BC=81=E9=B9=85=E5=B2=9B=E5=B2=9B=E4=B8=BB?= <76833996+zhengchengshi@users.noreply.github.com> Date: Sun, 8 Sep 2024 23:41:10 +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=20(#4541)?= 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; }