1.报错详情

2.尝试解决
方法一:在router/index.js下添加如下代码
import Vue from 'vue'
import VueRouter from 'vue-router'
// 解决重复点击路由报错的bug
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch((err) => err)
}
export default router方法二:如果是方法,在出错处添加.catch(error=>{})
methods: {
itemClick(){
//this.$router.replace(this.path)
this.$router.replace(this.path).catch(error=>{})
}
},版权声明:本文为qq_44684168原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。