From 4acce9ca00636606884cebd7a87ef6ad49e94340 Mon Sep 17 00:00:00 2001 From: xlsea Date: Fri, 16 May 2025 16:32:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=97=A0=E8=8F=9C=E5=8D=95=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=97=B6=E4=BD=BF=E7=94=A8=E9=BB=98=E8=AE=A4=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/route/index.ts | 4 ++++ src/views/system/menu/index.vue | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/store/modules/route/index.ts b/src/store/modules/route/index.ts index 3d0e52a3..5eb44012 100644 --- a/src/store/modules/route/index.ts +++ b/src/store/modules/route/index.ts @@ -24,6 +24,8 @@ import { updateLocaleOfGlobalMenus } from './shared'; +const defaultIcon = import.meta.env.VITE_MENU_ICON; + export const useRouteStore = defineStore(SetupStoreId.Route, () => { const authStore = useAuthStore(); const tabStore = useTabStore(); @@ -120,6 +122,8 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => { if (route.meta.icon?.startsWith('local-icon-')) { route.meta.localIcon = route.meta.icon.replace('local-icon-', 'menu-'); delete route.meta.icon; + } else if (!isNotNull(route.meta.icon)) { + route.meta.icon = defaultIcon; } // @ts-expect-error no hidden field diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index f66bc0d3..731bc88e 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -18,6 +18,8 @@ import MenuOperateDrawer from './modules/menu-operate-drawer.vue'; useDict('sys_show_hide'); useDict('sys_normal_disable'); +const defaultIcon = import.meta.env.VITE_MENU_ICON; + const { hasAuth } = useAuth(); const appStore = useAppStore(); const editingData = ref(); @@ -96,7 +98,7 @@ function renderPrefix({ option }: { option: TreeOption }) { const renderLocalIcon = String(option.icon).startsWith('local-icon-'); const icon = renderLocalIcon ? undefined : String(option.icon); const localIcon = renderLocalIcon ? String(option.icon).replace('local-icon-', 'menu-') : undefined; - return ; + return ; } function renderSuffix({ option }: { option: TreeOption }) {