From 7c38e9cf9fd161a0e296a047e904eeaf65d96f9f Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期二, 16 四月 2024 09:25:05 +0800 Subject: [PATCH] 校验修改 --- 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