From 6354b1da857aff13b863ad014c7e6b1f32a2cf3d Mon Sep 17 00:00:00 2001 From: saint3347 Date: Mon, 16 Dec 2024 19:50:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=81=BF=E5=85=8DTable=E5=9E=82?= =?UTF-8?q?=E7=9B=B4=E6=96=B9=E5=90=91=E4=B8=8A=E7=9A=84=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E6=9D=A1=E6=8A=96=E5=8A=A8=E7=8E=B0=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- packages/base/src/virtual-scroll/scroll.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index cd6b395c9..97c06b950 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "sheinx", "private": true, - "version": "3.5.5-beta.3", + "version": "3.5.5-beta.4", "description": "A react library developed with sheinx", "module": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/base/src/virtual-scroll/scroll.tsx b/packages/base/src/virtual-scroll/scroll.tsx index 6f781a42c..19d52c65a 100644 --- a/packages/base/src/virtual-scroll/scroll.tsx +++ b/packages/base/src/virtual-scroll/scroll.tsx @@ -57,7 +57,8 @@ const Scroll = (props: scrollProps) => { top: 0, } as React.CSSProperties; - const paddingTop = useMemo(() => Math.max(0, Math.floor(scrollHeight - height)), [scrollHeight, height]); + // 当滚动容器的高度为 0 时,paddingTop 为 0,避免滚动条抖动现象 + const paddingTop = height === 0 ? 0 : Math.max(0, Math.floor(scrollHeight - height)); const placeStyle = { paddingTop, width: scrollWidth,