From 57e1e48b2d0ad2f08b98f8b07d06055de81da0d6 Mon Sep 17 00:00:00 2001 From: chenxin <398275325@qq。> Date: Wed, 6 Aug 2025 14:07:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?perf(custom):=20sppage=E9=94=81=E5=AE=9A?= =?UTF-8?q?=E5=B1=8F=E5=B9=95=E5=AF=BC=E8=87=B4=E6=8A=96=E5=8A=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/sp-page/index.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/components/sp-page/index.js b/src/components/sp-page/index.js index 9a538e8b8..57572143a 100644 --- a/src/components/sp-page/index.js +++ b/src/components/sp-page/index.js @@ -85,18 +85,28 @@ const SpPage = memo( useEffect(() => { if (state.lock) { + // 保存当前滚动位置 + const currentScrollTop = scrollTopRef.current || 0 + setState((draft) => { draft.lockStyle = { - position: 'fixed', - top: `-${scrollTopRef.current}px`, - left: '0px', - width: '100%', - bottom: '0px' + overflow: 'hidden' } }) + + // 设置滚动位置,防止回到顶部 + setTimeout(() => { + Taro.pageScrollTo({ + scrollTop: currentScrollTop, + duration: 0 + }) + }, 0) + } else { setState((draft) => { - draft.lockStyle = {} + draft.lockStyle = { + overflow: 'auto' + } }) } }, [state.lock]) @@ -260,13 +270,6 @@ const SpPage = memo( setState((draft) => { draft.lock = false }) - - setTimeout(() => { - Taro.pageScrollTo({ - scrollTop: scrollTopRef.current, - duration: 0 - }) - }, 0) } })) const computedNavigationStyle = () => { From 76090cc6599680949a24399e5d27291a3ea7c80b Mon Sep 17 00:00:00 2001 From: chenxin <398275325@qq。> Date: Wed, 6 Aug 2025 17:22:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(custom):=20=E5=95=86=E5=93=81=E6=8C=82?= =?UTF-8?q?=E4=BB=B6=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/home/wgts/goods-grid-tab.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/wgts/goods-grid-tab.scss b/src/pages/home/wgts/goods-grid-tab.scss index 6033ee045..6e92e1dbe 100644 --- a/src/pages/home/wgts/goods-grid-tab.scss +++ b/src/pages/home/wgts/goods-grid-tab.scss @@ -61,7 +61,7 @@ } .brand-info { position: relative; - top: -55px; + top: -70px; overflow: hidden; left: 50%; transform: translateX(-50%);