-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
大神 我这个地方这么写怎么会死循环呢 #817
Comments
请对照 vue-element-admin/src/permission.js Lines 40 to 49 in 5070e20
你在有token情况下少了一个逻辑判断。当有 因为 |
我是不太明白这个next({ ...to, replace: true })代码执行的真正作用 能通俗易懂的说一下吗 |
// hack方法 确保addRoutes已完成 你可以试试直接 |
你的注释我有看到 就是不明白是怎么确保完成的 原理不明白 |
我的理解是这样:直接next()会resolve当前的钩子,导航直接放行,进入to的地址,但是在next中添加一个地址,会中断当前的导航,并创建一个新的导航,新的导航在开始时会确认routes,从而保证了addroutes完成并生效,,,replace只是保证了去掉历史,在浏览器上按后退键失效,去掉应该也行,可能是为了防止后退刷新的, |
感谢大哥!!
|
但是怎么解决呢?老是死循环 |
没错,但不知道为啥 |
大神 我这么写有什么问题 怎么有了token之后 next({...to,replace:true})这个地方会无限死循环 除了login都会进入死循环 求解 这个问题困扰了我好几天了
The text was updated successfully, but these errors were encountered: