Skip to content

Commit 9d8e6f0

Browse files
author
piexlmax
committed
登录后调整获取菜单逻辑,不再重复请求getMenu
1 parent 8dfbbdd commit 9d8e6f0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

web/src/permission.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ router.beforeEach(async(to, from, next) => {
3838
document.title = getPageTitle(to.meta.title)
3939
if (whiteList.indexOf(to.name) > -1) {
4040
if (token) {
41-
if (!asyncRouterFlag) {
41+
if (!asyncRouterFlag && whiteList.indexOf(from.name) < 0) {
4242
asyncRouterFlag++
4343
await getRouter()
4444
}
@@ -50,10 +50,9 @@ router.beforeEach(async(to, from, next) => {
5050
// 不在白名单中并且已经登陆的时候
5151
if (token) {
5252
// 添加flag防止多次获取动态路由和栈溢出
53-
if (!asyncRouterFlag) {
53+
if (!asyncRouterFlag && whiteList.indexOf(from.name) < 0) {
5454
asyncRouterFlag++
5555
await getRouter()
56-
5756
next({...to, replace: true })
5857
} else {
5958
if (to.matched.length) {

0 commit comments

Comments
 (0)