From ee98c6a4b16e023033b9539858eafa0b49eef959 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期三, 24 四月 2024 14:25:09 +0800 Subject: [PATCH] update --- src/router/index.js | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index bdbe374..3c6c586 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -4,6 +4,20 @@ Vue.use(Router) +// 瑙e喅鎶ラ敊 +const originalPush = Router.prototype.push +const originalReplace = Router.prototype.replace +// push +Router.prototype.push = function push (location, onResolve, onReject) { + if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject) + return originalPush.call(this, location).catch(err => err) +} +// replace +Router.prototype.replace = function push (location, onResolve, onReject) { + if (onResolve || onReject) return originalReplace.call(this, location, onResolve, onReject) + return originalReplace.call(this, location).catch(err => err) +} + export default new Router({ mode: 'history', base: process.env.BASE_URL, -- Gitblit v1.9.3