From dafcdd898caae57104f1155b0ec660ea333e7b19 Mon Sep 17 00:00:00 2001 From: Vben Date: Wed, 7 Jul 2021 23:40:04 +0800 Subject: [PATCH] fix: ensure that safari is running properly, fix #875 --- .eslintrc.js | 1 + commitlint.config.js | 25 ------------------------- src/router/helper/menuHelper.ts | 8 +++++--- 3 files changed, 6 insertions(+), 28 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d4c9c6cbbe4..f2dbfa168f7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -61,6 +61,7 @@ module.exports = defineConfig({ 'vue/singleline-html-element-content-newline': 'off', 'vue/attribute-hyphenation': 'off', 'vue/require-default-prop': 'off', + 'vue/script-setup-uses-vars': 'off', 'vue/html-self-closing': [ 'error', { diff --git a/commitlint.config.js b/commitlint.config.js index 7189e8f83bc..ac977af1707 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,31 +1,6 @@ module.exports = { ignores: [(commit) => commit.includes('init')], extends: ['@commitlint/config-conventional'], - parserPreset: { - parserOpts: { - headerPattern: /^(\w*|[\u4e00-\u9fa5]*)(?:[\(\(](.*)[\)\)])?[\:\:] (.*)/, - headerCorrespondence: ['type', 'scope', 'subject'], - referenceActions: [ - 'close', - 'closes', - 'closed', - 'fix', - 'fixes', - 'fixed', - 'resolve', - 'resolves', - 'resolved', - ], - issuePrefixes: ['#'], - noteKeywords: ['BREAKING CHANGE'], - fieldPattern: /^-(.*?)-$/, - revertPattern: /^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\./, - revertCorrespondence: ['header', 'hash'], - warn() {}, - mergePattern: null, - mergeCorrespondence: null, - }, - }, rules: { 'body-leading-blank': [2, 'always'], 'footer-leading-blank': [1, 'always'], diff --git a/src/router/helper/menuHelper.ts b/src/router/helper/menuHelper.ts index 3f5f47769b6..62a8478fb2c 100644 --- a/src/router/helper/menuHelper.ts +++ b/src/router/helper/menuHelper.ts @@ -72,14 +72,16 @@ export function transformRouteToMenu(routeModList: AppRouteModule[], routerMappi /** * config menu with given params */ -const menuParamRegex = /(?<=:)([\s\S]+?)((?=\/)|$)/g; +const menuParamRegex = /(?::)([\s\S]+?)((?=\/)|$)/g; export function configureDynamicParamsMenu(menu: Menu, params: RouteParams) { const { path, paramPath } = toRaw(menu); let realPath = paramPath ? paramPath : path; const matchArr = realPath.match(menuParamRegex); + matchArr?.forEach((it) => { - if (params[it]) { - realPath = realPath.replace(`:${it}`, params[it] as string); + const realIt = it.substr(1); + if (params[realIt]) { + realPath = realPath.replace(`:${realIt}`, params[realIt] as string); } }); // save original param path.