赞
踩
连续点击同一个路由,第二次点击时报错NavigationDuplicated。如图所示:
vue-router引入的地方加上如下代码段即可
import VueRouter from 'vue-router'
// 解决重复点击菜单导航报错:NavigationDuplicated 的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch(err => err)
}
详见:
https://blog.csdn.net/Beam007/article/details/103421755
Uncaught (in promise) Error: Navigation cancelled from "/login" to "/home" with a new navigation.
因为默认"/“跳转到”/login","/login"里面有跳转到"/home"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。