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({