From dafcdd898caae57104f1155b0ec660ea333e7b19 Mon Sep 17 00:00:00 2001 From: Vben <anncwb@126.com> Date: 星期三, 07 七月 2021 23:40:29 +0800 Subject: [PATCH] fix: ensure that safari is running properly, fix #875 --- src/router/helper/menuHelper.ts | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/router/helper/menuHelper.ts b/src/router/helper/menuHelper.ts index 3f5f477..62a8478 100644 --- a/src/router/helper/menuHelper.ts +++ b/src/router/helper/menuHelper.ts @@ -72,14 +72,16 @@ /** * 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. -- Gitblit v1.8.0