From e2aedd9fe0dd4eb6fe1a5860b30a1b005af27411 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 25 Nov 2019 10:31:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/router/index.js b/src/router/index.js index e4b0d0ffa..ae4f389af 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -878,8 +878,12 @@ router.beforeEach((to, from, next) => { // 兼容 vue-router在3.1.0版本以上的路由跳转使用的是 promise 的方式 const originalPush = Router.prototype.push; +const originalReplace = Router.prototype.replace; Router.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err); }; +Router.prototype.replace = function push(location) { + return originalReplace.call(this, location).catch(err => err); +}; export default router;