Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “/detail/1?id=1”
这是VueRouer中的官方错误,我们需要改一下push方法,代码如下,定义进去即可:
// 解决vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}