-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Menu: fix router NavigationDuplicated error when using vue-router@^3.1.0 #17145
Conversation
Deploy preview for element ready! Built with commit 19bae7d |
Reproduction Linkhttps://codepen.io/a631807682/pen/wvwgqmX?editors=1011 Fixed Linkhttps://codepen.io/a631807682/pen/rNBjGpj?editors=1011 Stepclick same path menu, see the console. Related Issuesthere no unit test about menu router, and i have no idea how to write it.
|
我们考虑用最低成本的方案解决,直接捕获这个错误而不是抛出来 |
我的理解是,要么不让这个错误发生,要么允许用户添加一个属性,让用户在发生错误的时候执行自定义的方法。而不是直接抛出或者静默。 |
首先 最完美的办法是 判断是否是相同的路由 如果相同则不跳转,但是 vuerouter 没有一个直接可用的 api, 而引入相关utils 又会对未来 新版本的兼容埋下潜在的坑, 其次这里 NavigationDuplicated 是 menu 组件自身的逻辑 导致 push 了相同的路由,那我们直接静默对用户应该也不回有不良的影响 |
我提了一个 兼容高低版本的修复方案 可以来 review 下 |
我看了 |
这里静默的只是 element menu NavigationDuplicated 错误 ,并不影响用户 router 的任何提示哈 |
我是指这种情况,我本来觉得这种情况可能要处理,但是我看
|
Please make sure these boxes are checked before submitting your PR, thank you!
dev
branch.Close #17044