const originalPush = Router.prototype.push // 获取原型对象上的push函数 Router.prototype.push = function push (location) { // 修改原型对象中的push方法 return originalPush.call(this, location).catch(err => err) } Vue.use(Router);