From f324b663a636f97da9c3316e477bdc464a74914c Mon Sep 17 00:00:00 2001 From: que01 Date: Thu, 8 Oct 2026 15:51:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A4=90=E9=A5=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=BA=95=E9=83=A8=E9=81=AE=E6=8C=A1=E5=8F=8A?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=8F=90=E4=BA=A4=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/taro/src/app.css | 7 +++- apps/taro/src/components/forms.css | 14 +++++++ apps/taro/test/browser/preview.spec.ts | 40 +++++++++++++++++++ docs/taro-migration-delivery.md | 4 ++ .../taro/style.css | 1 + 5 files changed, 65 insertions(+), 1 deletion(-) diff --git a/apps/taro/src/app.css b/apps/taro/src/app.css index 1633960..fb6d891 100644 --- a/apps/taro/src/app.css +++ b/apps/taro/src/app.css @@ -36,6 +36,12 @@ image { font-size: 22px; } /* postcss-pxtransform disable */ +/* H5 导航固定在视口底部,滚动页面必须保留真实像素的避让空间。 */ +.taro_tabbar_page { + box-sizing: border-box; + padding-bottom: calc(66px + env(safe-area-inset-bottom)); +} + @media (min-width: 430px) { html { font-size: 22.933333px !important; @@ -46,7 +52,6 @@ image { margin: 0 auto; } #app { - min-height: 100vh; background: #fafaf9; } .taro-tabbar__tabbar, diff --git a/apps/taro/src/components/forms.css b/apps/taro/src/components/forms.css index 163bcf2..54ff2f4 100644 --- a/apps/taro/src/components/forms.css +++ b/apps/taro/src/components/forms.css @@ -104,6 +104,13 @@ font-size: 24px; } .submit-button { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + min-height: 88px; + padding: 20px 24px; + line-height: 1.5; margin: 32px 0 0; background: #f97316; color: #fff; @@ -190,6 +197,13 @@ } .editorial-inquiry .submit-button, .editorial-forms .submit-button { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + min-height: 88px; + padding: 20px 24px; + line-height: 1.5; background: #202221; } .editorial-inquiry, diff --git a/apps/taro/test/browser/preview.spec.ts b/apps/taro/test/browser/preview.spec.ts index b4809de..91d2154 100644 --- a/apps/taro/test/browser/preview.spec.ts +++ b/apps/taro/test/browser/preview.spec.ts @@ -114,3 +114,43 @@ for (const width of [375, 430, 768, 1280]) { expect(bar!.width).toBeCloseTo(expectedWidth, 0); }); } + +for (const width of [375, 1280]) { + test(`餐饮控件与底部避让 ${width}`, async ({ page }) => { + await page.setViewportSize({ width, height: 812 }); + const scrollToBottom = async () => { + await page.evaluate(() => { + document.querySelectorAll("*").forEach((element) => { + if (/auto|scroll/.test(getComputedStyle(element).overflowY)) + element.scrollTop = element.scrollHeight; + }); + window.scrollTo(0, document.body.scrollHeight); + }); + }; + const aboveNavigation = async (selector: string) => { + const bottom = await page.locator(selector).last().boundingBox(); + const nav = await page.locator(".taro-tabbar__tabbar").boundingBox(); + expect(bottom!.y + bottom!.height).toBeLessThan(nav!.y - 8); + }; + await page.goto("/"); + await expect(page.locator(".food-home .promise").last()).toBeAttached(); + await scrollToBottom(); + await aboveNavigation(".food-home .promise"); + await page.goto("/#/pages/offerings/index"); + await expect(page.locator(".filter").first()).toBeVisible(); + const filters = await page + .locator(".filter") + .evaluateAll((elements) => elements.map((element) => element.getBoundingClientRect().width)); + expect(filters[0]).toBeLessThan(200); + await page.locator(".filter").nth(1).click(); + await expect(page.locator(".filter").nth(1)).toHaveClass(/active/); + await page.goto("/#/pages/inquiry/index"); + await expect(page.locator(".submit-button")).toBeVisible(); + await scrollToBottom(); + await aboveNavigation(".history-link"); + const button = await page.locator(".submit-button").boundingBox(); + expect(button!.height).toBeGreaterThanOrEqual(44); + await page.locator(".submit-button").click(); + await expect(page.locator(".form-error")).toContainText("请填写"); + }); +} diff --git a/docs/taro-migration-delivery.md b/docs/taro-migration-delivery.md index 6c348d0..0a20a9c 100644 --- a/docs/taro-migration-delivery.md +++ b/docs/taro-migration-delivery.md @@ -33,3 +33,7 @@ Web 未接入微信身份登录,没有已有会话时仅支持填写与校验 ## Web 预览宽度 手机小于 430px 时使用屏幕宽度;更宽屏幕使用居中的 430px 内容区。预览外框使用真实 CSS 像素并锁定对应 rem 基准,避免被 Taro 设计稿单位转换二次缩放。底部导航和详情操作栏与内容区对齐。响应式浏览器测试覆盖 375、430、768、1280px;包括原有交互共 9 项通过。 + +## 餐饮控件与底部避让修复 + +H5 tab 页面统一预留导航避让与安全区空间,删除桌面 app 最小高度对导航容器高度的干扰。餐品分类按钮明确使用内容宽度,避免 H5 Button 默认满宽挤走其他分类。提交按钮明确高度、内边距及文字居中。浏览器检查覆盖手机与桌面滚动到底后的首页最后卡片、咨询记录入口、分类切换和提交校验;共 11 项通过。餐饮 H5、微信构建及格式、类型、lint 通过。微信构建结果不替代微信 IDE 视觉验收。 diff --git a/packages/template-acheng-campus-food/taro/style.css b/packages/template-acheng-campus-food/taro/style.css index 9bcc435..7efc8c7 100644 --- a/packages/template-acheng-campus-food/taro/style.css +++ b/packages/template-acheng-campus-food/taro/style.css @@ -1117,6 +1117,7 @@ border-bottom: 1px solid #f5f5f4; } .food-list .filter { + width: auto; margin: 0; padding: 12px 24px; flex-shrink: 0;