Skip to content

Commit e035eab

Browse files
authored
optimize(projects): supports custom menu icon sizes (#534)
1 parent be13ca2 commit e035eab

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/store/modules/route/shared.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function getGlobalMenuByBaseRoute(route: RouteLocationNormalizedLoaded | Elegant
123123
const { SvgIconVNode } = useSvgIcon();
124124

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

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

@@ -133,7 +133,7 @@ function getGlobalMenuByBaseRoute(route: RouteLocationNormalizedLoaded | Elegant
133133
i18nKey,
134134
routeKey: name as RouteKey,
135135
routePath: path as RouteMap[RouteKey],
136-
icon: SvgIconVNode({ icon, localIcon, fontSize: 20 })
136+
icon: SvgIconVNode({ icon, localIcon, fontSize: iconFontSize || 20 })
137137
};
138138

139139
return menu;

src/typings/router.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ declare module 'vue-router' {
4242
* In "src/assets/svg-icon", if it is set, the icon will be ignored
4343
*/
4444
localIcon?: string;
45+
/** Icon size. width and height are the same. */
46+
iconFontSize?: number;
4547
/** Router order */
4648
order?: number | null;
4749
/** The outer link of the route */

0 commit comments

Comments
 (0)