From 377a41646ee5361e9e378e3f6361e1f43afa8f4f Mon Sep 17 00:00:00 2001 From: Yanbowen <349952469@qq.com> Date: Mon, 3 Jan 2022 10:46:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(projects):=20=E4=BF=AE=E5=A4=8D=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E8=8F=9C=E5=8D=95=E6=97=B6title=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/header/components/search/index.vue | 10 ++++++++-- src/router/staticModules/error.ts | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/layout/header/components/search/index.vue b/src/layout/header/components/search/index.vue index f07e76163..abae075fe 100644 --- a/src/layout/header/components/search/index.vue +++ b/src/layout/header/components/search/index.vue @@ -75,13 +75,18 @@ inputRef.value?.focus(); } }); + + const getTitle = (title) => { + return typeof title === 'string' ? title : title?.['zh_CN']; + }; + /** 查询 */ function search() { resultOptions.value = menusList.value.filter((menu) => { - const title = menu.meta?.title as string; + const title = getTitle(menu.meta?.title); return ( keyword.value && - title.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase().trim()) + title?.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase().trim()) ); }); if (resultOptions.value?.length > 0) { @@ -90,6 +95,7 @@ activePath.value = ''; } } + /** 将路由转换成菜单列表 */ function transformRouteToList(routes: RouteRecordRaw[], treeMap: RouteRecordRaw[] = []) { if (routes && routes.length === 0) return []; diff --git a/src/router/staticModules/error.ts b/src/router/staticModules/error.ts index 0b0fb4fb5..eb3deae80 100644 --- a/src/router/staticModules/error.ts +++ b/src/router/staticModules/error.ts @@ -29,6 +29,7 @@ export const errorRoute: RouteRecordRaw = { meta: { title: '404', icon: 'UserOutlined', + hideInMenu: true, }, component: () => import(/* webpackChunkName: "404" */ '@/views/shared/error/404.vue'), },