提交 2e3de862 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

登录后调整获取菜单逻辑,不再重复请求getMenu

上级 92edd81f
...@@ -38,7 +38,7 @@ router.beforeEach(async(to, from, next) => { ...@@ -38,7 +38,7 @@ router.beforeEach(async(to, from, next) => {
document.title = getPageTitle(to.meta.title) document.title = getPageTitle(to.meta.title)
if (whiteList.indexOf(to.name) > -1) { if (whiteList.indexOf(to.name) > -1) {
if (token) { if (token) {
if (!asyncRouterFlag) { if (!asyncRouterFlag && whiteList.indexOf(from.name) < 0) {
asyncRouterFlag++ asyncRouterFlag++
await getRouter() await getRouter()
} }
...@@ -50,10 +50,9 @@ router.beforeEach(async(to, from, next) => { ...@@ -50,10 +50,9 @@ router.beforeEach(async(to, from, next) => {
// 不在白名单中并且已经登陆的时候 // 不在白名单中并且已经登陆的时候
if (token) { if (token) {
// 添加flag防止多次获取动态路由和栈溢出 // 添加flag防止多次获取动态路由和栈溢出
if (!asyncRouterFlag) { if (!asyncRouterFlag && whiteList.indexOf(from.name) < 0) {
asyncRouterFlag++ asyncRouterFlag++
await getRouter() await getRouter()
next({...to, replace: true }) next({...to, replace: true })
} else { } else {
if (to.matched.length) { if (to.matched.length) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册