Uncaught (in promise) Error: Avoided redundant navigation to current location: “index“. 解决方法

tech2025-12-21  1

在router.js中加入以下代码就可以

const originalPush = Router.prototype.push Router.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) }

如果你的改了push还是没有生效,修改路由replace方法,阻止重复点击报错

const originalReplace = VueRouter.prototype.replace; VueRouter.prototype.replace = function replace(location) { return originalReplace.call(this, location).catch(err => err); };

 

最新回复(0)