From ce05abd97a5bd34b5a266a9430378da2699dd007 Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Sun, 15 Nov 2020 17:57:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B7=AF=E7=94=B1=E5=89=8D?= =?UTF-8?q?=E7=BD=AE=E5=AE=88=E5=8D=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index c5479155..45c08d57 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -171,8 +171,6 @@ router.beforeEach(async(to, from, next) => { name: store.getters['menu/sidebarRoutes'][0].name, replace: true }) - } else { - next() } } else { // 如果是通过 name 跳转,并且 name 对应的路由没有权限时,需要做这步处理,手动指向到 404 页面 @@ -180,14 +178,6 @@ router.beforeEach(async(to, from, next) => { path: '/404' }) } - } else { - // 百度统计代码 - if (process.env.VUE_APP_TYPE == 'example') { - if (window._hmt) { - window._hmt.push(['_trackPageview', location.pathname + '#' + to.fullPath]) - } - } - next() } } else { if (to.name != 'login') { @@ -197,16 +187,18 @@ router.beforeEach(async(to, from, next) => { redirect: to.fullPath } }) - } else { - // 百度统计代码 - if (process.env.VUE_APP_TYPE == 'example') { - if (window._hmt) { - window._hmt.push(['_trackPageview', location.pathname + '#' + to.fullPath]) - } - } - next() } } + // 百度统计代码 + if (process.env.VUE_APP_TYPE == 'example') { + if (window._hmt) { + window._hmt.push(['_trackPageview', location.pathname + '#' + to.fullPath]) + } + } + next() +}) + +router.afterEach(() => { store.state.settings.enableProgress && NProgress.done() })