Skip to content

Commit 9e2606f

Browse files
rysinalsendya
authored andcommitted
修复动态路由重复添加可能导致的页面卡死BUG
1 parent 4f3e458 commit 9e2606f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/permission.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import router from './router'
1+
import router, { resetRouter } from './router'
22
import store from './store'
33
import storage from 'store'
44
import NProgress from 'nprogress' // progress bar
@@ -35,6 +35,7 @@ router.beforeEach((to, from, next) => {
3535
// 根据roles权限生成可访问的路由表
3636
// 动态添加可访问路由表
3737
// [email protected]+ New API
38+
resetRouter() // 重置路由 防止退出重新登录或者token过期后页面未刷新,导致的路由重复添加
3839
store.getters.addRouters.forEach(r => {
3940
router.addRoute(r)
4041
})

0 commit comments

Comments
 (0)