feat: 无菜单图标时使用默认菜单图标
This commit is contained in:
parent
e8c83e6bc6
commit
4acce9ca00
@ -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
|
||||
|
@ -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<Api.System.Menu>();
|
||||
@ -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 <SvgIcon icon={icon} localIcon={localIcon} />;
|
||||
return <SvgIcon icon={icon || defaultIcon} localIcon={localIcon} />;
|
||||
}
|
||||
|
||||
function renderSuffix({ option }: { option: TreeOption }) {
|
||||
|
Loading…
Reference in New Issue
Block a user