main.js
import Router from 'vue-router' // 这个是为了避免一个报错 const originalPush = Router.prototype.push; Router.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) }