vue路由解决Uncaught (in promise) Error: Avoided redundant navigation to current location: “/home/news“.

在添加以下步骤后报错,可是不影响使用:vue

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

解决办法:vue-router

在router文件夹下的index.js中加入以下代码,错误消失this

import Vue from 'vue'
import VueRouter from 'vue-router'
//import HelloWorld from '@/components/HelloWorld'
const originalPush = VueRouter.prototype.push
   VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
相关文章
相关标签/搜索