From 48c0f1ad093565c8fd539196ffbc04488b841c9f Mon Sep 17 00:00:00 2001 From: zhangjing1 Date: Fri, 6 Mar 2026 15:44:41 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=A6=96=E9=A1=B5=20body=20?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E6=94=B9=E4=B8=BA=20calc(100vh=20-=20?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=20-=20=E5=BA=95=E6=A0=8F)=20(ECX-80?= =?UTF-8?q?66)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made-with: Cursor --- docs/records/2026-03-06-ECX-8066.md | 5 +++++ src/pages/index.js | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 docs/records/2026-03-06-ECX-8066.md diff --git a/docs/records/2026-03-06-ECX-8066.md b/docs/records/2026-03-06-ECX-8066.md new file mode 100644 index 000000000..83ddb9fb5 --- /dev/null +++ b/docs/records/2026-03-06-ECX-8066.md @@ -0,0 +1,5 @@ +# 2026-03-06 | ECX-8066 | 首页 body 高度计算方式调整 + +- **说明**:首页 onReady 中 body 高度由直接使用 SpPage 传入的 height 改为使用 `calc(100vh - gNavbarH - footerHeight)` 计算,与导航栏、底栏高度对齐,避免高度偏差。 +- **涉及**:`src/pages/index.js` +- **类型**:refactor diff --git a/src/pages/index.js b/src/pages/index.js index 20d9239be..6b805a569 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -301,9 +301,9 @@ function Home() { }} ref={pageRef} navigateMantle={navigateMantle} - onReady={({ height, gNavbarH }) => { + onReady={({ gNavbarH,footerHeight }) => { setState((draft) => { - draft.bodyHeight = height + draft.bodyHeight = `calc(100vh - ${gNavbarH}px - ${footerHeight})` draft.navbarHeight = gNavbarH }) }} @@ -315,7 +315,7 @@ function Home() { pageRef.current.handlePageScroll(e?.detail) }} scrollIntoView={scrollIntoView} - style={{ height: state.bodyHeight }} + style={{ height: state.bodyHeight}} className={classNames('home-body', { 'has-home-header': isShowHomeHeader && isWeixin })}