Vue路由bug-NavigationDuplicated: Avoided redundant navigation to current location: “/home/news“.

在写路由时添加了如下代码,报错,但是并不影响结果

activated(){
   this.$router.push(this.path);
},

在这里插入图片描述
解决办法:
在router/index.js中加入如下代码

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

版权声明:本文为weixin_47966382原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。