Skip to content
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

vue-router 4.x 告警:[Vue Router warn]: No match found for location with path #271

Open
smileyby opened this issue Jun 12, 2023 · 1 comment
Labels

Comments

@smileyby
Copy link
Owner

smileyby commented Jun 12, 2023

场景:存在通过 addRoute添加的 异步鉴权路由,当在鉴权路由页面刷新时,会出现以上告警
原因:由于路由匹配先与 addRoute 导致
解决:在路由表中添加 404 路由
代码如下图1

另外一个问题:在刷新时处在动态添加的路由时,路由还未添加的问题
解决办法:在beforeEach 钩子函数中跳转下一步时添加 replace: true即可

代码如下图2

@smileyby
Copy link
Owner Author

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant