-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Description
在创建新的用户后,配置一个新的角色,并给这个角色一个菜单权限。初次登录这个账号会 404.刷新下就正常。问题出在了eladmin-web/src/router/index.js 的loadMenus 方法。 router.addRoutes(rewriteRoutes)还没有执行完,就跳转首次 404
修复后代码如下:
store.dispatch('GenerateRoutes', rewriteRoutes).then(() => { // 存储路由
router.addRoutes(rewriteRoutes)
// 延迟跳转,确保组件加载完成,不然首次的话会 404需要刷新才正常
setTimeout(() => {
next({ ...to, replace: true })
}, 300)
})
Metadata
Metadata
Assignees
Labels
No labels