const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) } // 下面的代码是vue的路由中的默认代码,把上面的代码复制粘贴到new VueRouter之前就ok const router = new VueRouter({ routes })