From b4539da84c4aa771d73c2b3b0fa66e73e68a8300 Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Mon, 18 Mar 2024 11:02:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=8F=9C=E5=8D=95=E4=B8=8D?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E5=A4=A7=E5=B0=8F=E5=86=99=EF=BC=8C=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E6=94=AF=E6=8C=81=E5=A4=96=E9=83=A8=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/src/search/useMenuSearch.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/Application/src/search/useMenuSearch.ts b/src/components/Application/src/search/useMenuSearch.ts index d5c5282..22b4328 100644 --- a/src/components/Application/src/search/useMenuSearch.ts +++ b/src/components/Application/src/search/useMenuSearch.ts @@ -12,6 +12,7 @@ export interface SearchResult { name: string; path: string; icon?: string; + internalOrExternal: boolean; } // Translate special characters @@ -23,7 +24,7 @@ function transform(c: string) { function createSearchReg(key: string) { const keys = [...key].map((item) => transform(item)); const str = ['', ...keys, ''].join('.*'); - return new RegExp(str); + return new RegExp(str, 'i'); } export function useMenuSearch(refs: Ref, scrollWrap: Ref, emit: EmitType) { @@ -68,12 +69,13 @@ export function useMenuSearch(refs: Ref, scrollWrap: Ref, function handlerSearchResult(filterMenu: Menu[], reg: RegExp, parent?: Menu) { const ret: SearchResult[] = []; filterMenu.forEach((item) => { - const { name, path, icon, children, hideMenu, meta } = item; + const { name, path, icon, children, hideMenu, meta, internalOrExternal } = item; if (!hideMenu && reg.test(name) && (!children?.length || meta?.hideChildrenInMenu)) { ret.push({ name: parent?.name ? `${parent.name} > ${name}` : name, path, icon, + internalOrExternal }); } if (!meta?.hideChildrenInMenu && Array.isArray(children) && children.length) { @@ -149,7 +151,14 @@ export function useMenuSearch(refs: Ref, scrollWrap: Ref, const to = result[index]; handleClose(); await nextTick(); - go(to.path); + + // update-begin--author:liaozhiyang---date:20230803---for:【QQYUN-8369】搜索区分大小写,外部链接新页打开 + if (to.internalOrExternal) { + window.open(to.path, '_blank'); + } else { + go(to.path); + } + // update-end--author:liaozhiyang---date:20230803---for:【QQYUN-8369】搜索区分大小写,外部链接新页打开 } // close search modal