diff --git a/src/core/service/api/navigation-bar.js b/src/core/service/api/navigation-bar.js index 268d06f48543523db946545a88efa17b0e430eb5..f5d095d92807db56b10e228f090e966554a61ae4 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 4463aa6fcbccc054656856fc82cdebea3450ce5c..933b156588b5ff70882c06681c4a80cb49a79471 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 f532d39cdbdd5ea58cae54aec1a27d397d6bac56..445d575c3fd615a55cf8a4e074a837ac5adc2c7d 100644 --- a/src/platforms/h5/components/page/index.vue +++ b/src/platforms/h5/components/page/index.vue @@ -1,18 +1,18 @@