Uncaught (in promise) Error: Avoided redundant navigation to current location: “/index“. 解决方法
在router.js中加入以下代码就可以const originalPush = Router.prototype.pushRouter.prototype.push = function push(location) {return originalPush.call(this, location).catch(err => err)}如果你的改了push还是没有生效,修改路由replac
·
在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);
};
更多推荐
已为社区贡献26条内容
所有评论(0)