Skip to content

Commit

Permalink
feat(projects): supports custom menu icon sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Sep 8, 2024
1 parent 4355b6e commit c8a9e85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/store/modules/route/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function getGlobalMenuByBaseRoute(route: RouteLocationNormalizedLoaded | Elegant
const { SvgIconVNode } = useSvgIcon();

const { name, path } = route;
const { title, i18nKey, icon = import.meta.env.VITE_MENU_ICON, localIcon } = route.meta ?? {};
const { title, i18nKey, icon = import.meta.env.VITE_MENU_ICON, localIcon, iconFontSize } = route.meta ?? {};

const label = i18nKey ? $t(i18nKey) : title!;

Expand All @@ -134,7 +134,7 @@ function getGlobalMenuByBaseRoute(route: RouteLocationNormalizedLoaded | Elegant
i18nKey,
routeKey: name as RouteKey,
routePath: path as RouteMap[RouteKey],
icon: SvgIconVNode({ icon, localIcon, fontSize: 20 }),
icon: SvgIconVNode({ icon, localIcon, fontSize: iconFontSize || 20 }),
title: label
};

Expand Down
2 changes: 2 additions & 0 deletions src/typings/router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ declare module 'vue-router' {
* In "src/assets/svg-icon", if it is set, the icon will be ignored
*/
localIcon?: string;
/** Icon size. width and height are the same. */
iconFontSize?: number;
/** Router order */
order?: number | null;
/** The outer link of the route */
Expand Down

0 comments on commit c8a9e85

Please sign in to comment.