From af2da948db8904cb8c1d1e841d300050578a83e5 Mon Sep 17 00:00:00 2001 From: qiang Date: Thu, 27 Jun 2019 17:29:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DH5=E7=AB=AF=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=83=85=E5=86=B5document.title=E4=B8=8D=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9B=B4=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/service/api/navigation-bar.js | 5 +++- src/core/service/plugins/app/router-guard.js | 11 +++++--- src/platforms/h5/components/page/index.vue | 27 +++++++++++-------- src/platforms/h5/components/page/pageHead.vue | 9 +------ .../system-routes/system-header.vue | 5 ++++ 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/core/service/api/navigation-bar.js b/src/core/service/api/navigation-bar.js index 268d06f48..f5d095d92 100644 --- a/src/core/service/api/navigation-bar.js +++ b/src/core/service/api/navigation-bar.js @@ -34,6 +34,9 @@ function setNavigationBar (type, args) { title } = args page.navigationBar.titleText = title + if (__PLATFORM__ === 'h5') { + document.title = title + } break } } @@ -53,4 +56,4 @@ export function hideNavigationBarLoading () { export function setNavigationBarTitle (args) { return setNavigationBar('setNavigationBarTitle', args) -} +} diff --git a/src/core/service/plugins/app/router-guard.js b/src/core/service/plugins/app/router-guard.js index 4463aa6fc..933b15658 100644 --- a/src/core/service/plugins/app/router-guard.js +++ b/src/core/service/plugins/app/router-guard.js @@ -39,9 +39,9 @@ function saveTabBarScrollPosition (id) { function switchTab (routes, to, from) { if ( to && - from && - to.meta.isTabBar && - from.meta.isTabBar + from && + to.meta.isTabBar && + from.meta.isTabBar ) { // tabbar 跳 tabbar saveTabBarScrollPosition(from.params.__id__) } @@ -196,6 +196,9 @@ function afterEach (to, from) { setTimeout(function () { callPageHook(toVm, 'onShow') }, 0) + if (__PLATFORM__ === 'h5') { + document.title = toVm.$parent.$parent.navigationBar.titleText + } } } } @@ -208,4 +211,4 @@ export default function initRouterGuard (appVm, routes) { appVm.$router.afterEach(function (to, from) { afterEach.call(appVm, to, from) }) -} +} diff --git a/src/platforms/h5/components/page/index.vue b/src/platforms/h5/components/page/index.vue index f532d39cd..445d575c3 100644 --- a/src/platforms/h5/components/page/index.vue +++ b/src/platforms/h5/components/page/index.vue @@ -1,18 +1,18 @@