fix: 调用next(...)重定向不会触发router.afterEach钩子

在未登录状态下,在地址栏输入需要登录后才能访问的页面url,应用会重定向至login。但是这时顶部的 NProgress 依然在加载中,因为`next(...)`重定向不会触发`router.afterEach`钩子,这里需要手动hack一下。

Former-commit-id: 1fa31ccca534e54a920451320c971eaf4b771417
This commit is contained in:
Zhu
2018-11-19 22:58:24 +08:00
committed by GitHub
parent f719225b5c
commit 354d0d7962
+1
View File
@@ -43,6 +43,7 @@ router.beforeEach((to, from, next) => {
next({ next({
name: 'login' name: 'login'
}) })
NProgress.done() // next(...)重定向不会触发router.afterEach钩子,需要手动hack一下
} }
} else { } else {
// 不需要身份校验 直接通过 // 不需要身份校验 直接通过