From e74dc58bbd1f3151256ff2b7dd197d5d0464f302 Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 12 Aug 2020 17:19:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E4=BB=8E=20H5=20?= =?UTF-8?q?=E7=AB=AF=E4=BB=8E=E9=A6=96=E9=A1=B5=E8=B0=83=E7=94=A8=20uni.re?= =?UTF-8?q?directTo=20=E5=88=87=E6=8D=A2=E5=85=B6=E4=BB=96=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=90=8E=E9=A6=96=E9=A1=B5=E6=9C=AA=E9=94=80=E6=AF=81?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20question/103503?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/service/plugins/app/router-guard.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/service/plugins/app/router-guard.js b/src/core/service/plugins/app/router-guard.js index 27ec5e19f2..726c8fcec5 100644 --- a/src/core/service/plugins/app/router-guard.js +++ b/src/core/service/plugins/app/router-guard.js @@ -104,7 +104,7 @@ function beforeEach (to, from, next, routes) { if (from.meta.isQuit) { // 如果 redirectTo 的前一个页面是 quit 类型,则新打开的页面也是 quit to.meta.isQuit = true to.meta.isEntry = !!from.meta.isEntry - } + } // 小程序没有这个逻辑,当时为何加了保留并更新 tabBar 的逻辑? // if (from.meta.isTabBar) { // 如果是 tabBar,需要更新系统组件 tabBar 内的 list 数据 // to.meta.isTabBar = true @@ -133,7 +133,7 @@ function beforeEach (to, from, next, routes) { break } - if (to.type !== 'reLaunch' && from.meta.id) { // 如果不是 reLaunch,且 meta 指定了 id + if (to.type !== 'reLaunch' && to.type !== 'redirectTo' && from.meta.id) { // 如果不是 reLaunch、redirectTo,且 meta 指定了 id addKeepAliveInclude.call(this, fromName) } // if (to.type !== 'reLaunch') { // TODO 如果 reLaunch,1.keepAlive的话,无法触发页面生命周期,并刷新页面,2.不 keepAlive 的话,页面状态无法再次保留,且 routeView 的 cache 有问题 @@ -223,4 +223,4 @@ export default function initRouterGuard (appVm, routes) { appVm.$router.afterEach(function (to, from) { afterEach.call(appVm, to, from) }) -} +} -- GitLab