Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location

it2023-09-26  64

问题描述:

重复点击出现错误,跳转的时候出现错误: Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location

原因分析:

vue-router的版本不同

解决方案:

在main.js文件中添加以下代码

import VueRouter from "vue-router"; const VueRouterPush = VueRouter.prototype.push VueRouter.prototype.push = function push (to) { return VueRouterPush.call(this, to).catch(err => err) } const VueRouterReplace = VueRouter.prototype.replace VueRouter.prototype.replace = function replace (to) { return VueRouterReplace.call(this, to).catch(err => err) }
最新回复(0)