报错原因:
在当前页面重复跳转到当前页面
报错代码
NavigationDuplicated: Avoided redundant navigation to current location: "/list".
导航重复:避免冗余导航到当前位置
解决
在router文件夹里的index.js,写下中间那段代码
Vue.use(VueRouter)
// 获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
// 修改原型对象中的push方法
VueRouter.prototype.push = function push(location){
return originalPush.call(this, location).catch(err => err)
}
const routes = []