From 8edb6047f07e31e3d84698265824771c757eb227 Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Wed, 24 Nov 2021 14:54:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=96=E9=93=BE=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=9C=A8=E5=8A=A8=E6=80=81=E6=B7=BB=E5=8A=A0=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E6=97=B6=E5=8F=AF=E8=83=BD=E4=BC=9A=E5=BC=95=E8=B5=B7?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index df4cfc14..cc8686aa 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -136,7 +136,9 @@ router.beforeEach(async(to, from, next) => { accessRoutes.push(lastRoute) let removeRoutes = [] accessRoutes.forEach(route => { - removeRoutes.push(router.addRoute(route)) + if (!/^(https?:|mailto:|tel:)/.test(route.path)) { + removeRoutes.push(router.addRoute(route)) + } }) // 记录的 accessRoutes 路由数据,在登出时会使用到,不使用 router.removeRoute 是考虑配置的路由可能不一定有设置 name ,则通过调用 router.addRoute() 返回的回调进行删除 store.commit('menu/setCurrentRemoveRoutes', removeRoutes)