方法1.在路由中加入catch
jumprouting(e){
this.$router.push(e.path).catch(err => err)
}
方法2.router.js
Vue.use(VueRouter);
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}