From 16823b2ef7092e7838a4da228d05c2bf777a7897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tony=E6=98=9F?= <7762581+tony_tong_xin@user.noreply.gitee.com> Date: Mon, 9 Jan 2023 12:22:42 +0000 Subject: [PATCH] update src/utils/other.ts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tony星 <7762581+tony_tong_xin@user.noreply.gitee.com> --- src/utils/other.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/other.ts b/src/utils/other.ts index 08dd477..4b21e30 100644 --- a/src/utils/other.ts +++ b/src/utils/other.ts @@ -53,8 +53,10 @@ export function useTitle() { export function setTagsViewNameI18n(item: any) { let tagsViewName: string = ''; const { query, params, meta } = item; + //修复tagsViewName匹配到其他含下列单词的路由 + const pattern =/^\{("(zh-cn|en|zh-tw)":"[^,]+",?){1,3}}$/; if (query?.tagsViewName || params?.tagsViewName) { - if (/\/zh-cn|en|zh-tw\//.test(query?.tagsViewName) || /\/zh-cn|en|zh-tw\//.test(params?.tagsViewName)) { + if (pattern.test(query?.tagsViewName) || pattern.test(params?.tagsViewName)) { // 国际化 const urlTagsParams = (query?.tagsViewName && JSON.parse(query?.tagsViewName)) || (params?.tagsViewName && JSON.parse(params?.tagsViewName)); tagsViewName = urlTagsParams[i18n.global.locale.value];