From 998fcf714666739dddd6b41e71e5fba8cb104826 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Tue, 19 Nov 2019 17:57:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/router/index.js b/src/router/index.js index 0bc95fd84..e4b0d0ffa 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -876,4 +876,10 @@ router.beforeEach((to, from, next) => { next(); }); +// 兼容 vue-router在3.1.0版本以上的路由跳转使用的是 promise 的方式 +const originalPush = Router.prototype.push; +Router.prototype.push = function push(location) { + return originalPush.call(this, location).catch(err => err); +}; + export default router;