From 1276a44b6b70eb8fa26e4779ed8ae06f36fef490 Mon Sep 17 00:00:00 2001 From: jing <1683105490@qq.com> Date: Sat, 17 Oct 2026 11:51:10 +0800 Subject: [PATCH] =?UTF-8?q?chore:=E5=90=8D=E7=89=87=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E9=A2=9C=E8=89=B2=E6=94=B9=E6=88=90=E7=99=BD=E8=89=B2?= =?UTF-8?q?=E2=80=9D=E5=90=8D=E7=89=87=E2=80=9C=E8=BF=99=E4=B8=A4=E4=B8=AA?= =?UTF-8?q?=E5=AD=97=E6=94=B9=E6=88=90=E9=BB=91=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 6 +++--- pages_tool/card/detail.vue | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/pages.json b/pages.json index 42dd7ba..4f19b71 100644 --- a/pages.json +++ b/pages.json @@ -1477,9 +1477,9 @@ { "path": "card/detail", "style": { - "navigationBarTitleText": "我的名片", - "navigationBarBackgroundColor": "#2aa5ff", - "navigationBarTextStyle": "white" + "navigationBarTitleText": "名片", + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "black" } }, { diff --git a/pages_tool/card/detail.vue b/pages_tool/card/detail.vue index 7540a5c..b5b2b24 100644 --- a/pages_tool/card/detail.vue +++ b/pages_tool/card/detail.vue @@ -350,11 +350,19 @@ export default { }, onLoad(options) { this.cardId = decodeURIComponent(options.card_id || ''); + this.applyPageTitle(); this.loadDetail(); this.loadExchange(); this.loadDesignEnabled(); }, + // H5 直接刷新/深链进入时, uni-page-head 可能在路由 meta 就绪前就挂载, + // 此时标题会回落到 document.title(uni-app H5 默认值 "title"); + // onLoad 设得过早会被这次回落覆盖, 故 onReady(已挂载)再设一次兜死。 + onReady() { + this.applyPageTitle(); + }, onShow() { + this.applyPageTitle(); // 首次进入由 onLoad 负责加载; 从编辑页返回时(onShow 再次触发)刷新 if (this._loadedOnce) { this.loadDetail(); @@ -378,6 +386,15 @@ export default { }; }, methods: { + // 导航栏标题统一出口: 小程序/鸿蒙/App 走原生导航栏; + // H5 额外同步 document.title, 避免 uni-page-head 标题回落到默认值 "title"。 + applyPageTitle() { + const title = '名片'; + uni.setNavigationBarTitle({ title }); + // #ifdef H5 + document.title = title; + // #endif + }, goEdit() { if (!this.cardId) return; uni.navigateTo({