diff --git a/packages/layouts/src/components/menu/index.vue b/packages/layouts/src/components/menu/index.vue index 2c94fe7f..758361e0 100644 --- a/packages/layouts/src/components/menu/index.vue +++ b/packages/layouts/src/components/menu/index.vue @@ -10,14 +10,16 @@ import { useI18n } from '@vben/locale' import { REDIRECT_NAME } from '@vben/constants' import { renderIcon } from '../index' import { context } from '../../../bridge' +import type { RouteMeta } from 'vue-router' -const { Logo, useAppInject, useAppConfig } = context +const { Logo, useAppInject, useAppConfig, useMenuSetting } = context import { getMenus, listenerRouteChange } from '@vben/router' const { getIsMobile } = useAppInject() const { menu, isMixSidebar, getCollapsedShowTitle, sidebar, isSidebar } = useAppConfig() +const { getTopMenuAlign } = useMenuSetting() const showSidebarLogo = computed(() => { return unref(isSidebar) || unref(isMixSidebar) }) @@ -72,7 +74,7 @@ async function handleMenuChange(route?: RouteLocationNormalizedLoaded) { } // 路由格式化 -const routerToMenu = (item: RouteRecordItem) => { +const routerToMenu = (item: RouteRecordItem & RouteMeta) => { const { name, children, meta, icon } = item const title = t(meta.title as string) return { @@ -106,6 +108,11 @@ const routerToMenu = (item: RouteRecordItem) => { { +