From 384c5d7dbbaf1940c88acc6b6ff80c17cc839bcf Mon Sep 17 00:00:00 2001 From: wyc001122 <498040880@qq.com> Date: Sat, 5 Apr 2025 11:04:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=B8=83=E5=B1=80=E4=B8=BA=E5=8F=8C?= =?UTF-8?q?=E5=88=97=E8=8F=9C=E5=8D=95=E6=88=96=E8=80=85=E6=B0=B4=E5=B9=B3?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=EF=BC=8C=20=E4=B8=80=E7=BA=A7?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E9=AB=98=E4=BA=AE=E9=97=AE=E9=A2=98=20(#5870?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 王泳超 --- .../@core/ui-kit/menu-ui/src/components/menu.vue | 4 ---- .../layouts/src/basic/menu/use-extra-menu.ts | 14 +++++++++----- .../layouts/src/basic/menu/use-mixed-menu.ts | 14 +++++++++----- .../layouts/src/basic/menu/use-navigation.ts | 14 +++++++++++++- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/packages/@core/ui-kit/menu-ui/src/components/menu.vue b/packages/@core/ui-kit/menu-ui/src/components/menu.vue index f570aa72..7a737008 100644 --- a/packages/@core/ui-kit/menu-ui/src/components/menu.vue +++ b/packages/@core/ui-kit/menu-ui/src/components/menu.vue @@ -23,7 +23,6 @@ import { import { useNamespace } from '@vben-core/composables'; import { Ellipsis } from '@vben-core/icons'; -import { isHttpUrl } from '@vben-core/shared/utils'; import { useResizeObserver } from '@vueuse/core'; @@ -248,9 +247,6 @@ function handleMenuItemClick(data: MenuItemClicked) { if (!path || !parentPaths) { return; } - if (!isHttpUrl(path)) { - activePath.value = path; - } emit('select', path, parentPaths); } diff --git a/packages/effects/layouts/src/basic/menu/use-extra-menu.ts b/packages/effects/layouts/src/basic/menu/use-extra-menu.ts index c213cff2..e2afb741 100644 --- a/packages/effects/layouts/src/basic/menu/use-extra-menu.ts +++ b/packages/effects/layouts/src/basic/menu/use-extra-menu.ts @@ -13,7 +13,7 @@ import { useNavigation } from './use-navigation'; function useExtraMenu(useRootMenus?: ComputedRef) { const accessStore = useAccessStore(); - const { navigation } = useNavigation(); + const { navigation, willOpenedByWindow } = useNavigation(); const menus = computed(() => useRootMenus?.value ?? accessStore.accessMenus); @@ -33,11 +33,15 @@ function useExtraMenu(useRootMenus?: ComputedRef) { * @param menu */ const handleMixedMenuSelect = async (menu: MenuRecordRaw) => { - extraMenus.value = menu?.children ?? []; - extraActiveMenu.value = menu.parents?.[parentLevel.value] ?? menu.path; - const hasChildren = extraMenus.value.length > 0; + const _extraMenus = menu?.children ?? []; + const hasChildren = _extraMenus.length > 0; + + if (!willOpenedByWindow(menu.path)) { + extraMenus.value = _extraMenus ?? []; + extraActiveMenu.value = menu.parents?.[parentLevel.value] ?? menu.path; + sidebarExtraVisible.value = hasChildren; + } - sidebarExtraVisible.value = hasChildren; if (!hasChildren) { await navigation(menu.path); } else if (preferences.sidebar.autoActivateChild) { diff --git a/packages/effects/layouts/src/basic/menu/use-mixed-menu.ts b/packages/effects/layouts/src/basic/menu/use-mixed-menu.ts index c1d27fd4..6129e9d8 100644 --- a/packages/effects/layouts/src/basic/menu/use-mixed-menu.ts +++ b/packages/effects/layouts/src/basic/menu/use-mixed-menu.ts @@ -10,7 +10,7 @@ import { findRootMenuByPath } from '@vben/utils'; import { useNavigation } from './use-navigation'; function useMixedMenu() { - const { navigation } = useNavigation(); + const { navigation, willOpenedByWindow } = useNavigation(); const accessStore = useAccessStore(); const route = useRoute(); const splitSideMenus = ref([]); @@ -89,11 +89,15 @@ function useMixedMenu() { navigation(key); return; } - const rootMenu = menus.value.find((item) => item.path === key); - rootMenuPath.value = rootMenu?.path ?? ''; - splitSideMenus.value = rootMenu?.children ?? []; - if (splitSideMenus.value.length === 0) { + const _splitSideMenus = rootMenu?.children ?? []; + + if (!willOpenedByWindow(key)) { + rootMenuPath.value = rootMenu?.path ?? ''; + splitSideMenus.value = _splitSideMenus; + } + + if (_splitSideMenus.length === 0) { navigation(key); } else if (rootMenu && preferences.sidebar.autoActivateChild) { navigation( diff --git a/packages/effects/layouts/src/basic/menu/use-navigation.ts b/packages/effects/layouts/src/basic/menu/use-navigation.ts index 2de3fe51..4fbbeb7a 100644 --- a/packages/effects/layouts/src/basic/menu/use-navigation.ts +++ b/packages/effects/layouts/src/basic/menu/use-navigation.ts @@ -29,7 +29,19 @@ function useNavigation() { } }; - return { navigation }; + const willOpenedByWindow = (path: string) => { + const route = routeMetaMap.get(path); + const { openInNewWindow = false } = route?.meta ?? {}; + if (isHttpUrl(path)) { + return true; + } else if (openInNewWindow) { + return true; + } else { + return false; + } + }; + + return { navigation, willOpenedByWindow }; } export { useNavigation }; From d216fdca449b967160937f3347f25e3582ff95b2 Mon Sep 17 00:00:00 2001 From: Netfan Date: Sat, 5 Apr 2025 13:07:52 +0800 Subject: [PATCH 2/2] feat: support logo text slot (#5872) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 基础布局中的LOGO的文字区域允许通过插槽logo-text定制 --- .../ui-kit/shadcn-ui/src/components/logo/logo.vue | 13 +++++++------ packages/effects/layouts/src/basic/layout.vue | 12 ++++++++++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/@core/ui-kit/shadcn-ui/src/components/logo/logo.vue b/packages/@core/ui-kit/shadcn-ui/src/components/logo/logo.vue index 13680c56..829b7911 100644 --- a/packages/@core/ui-kit/shadcn-ui/src/components/logo/logo.vue +++ b/packages/@core/ui-kit/shadcn-ui/src/components/logo/logo.vue @@ -55,12 +55,13 @@ withDefaults(defineProps(), { :size="logoSize" class="relative rounded-none bg-transparent" /> - - {{ text }} - + diff --git a/packages/effects/layouts/src/basic/layout.vue b/packages/effects/layouts/src/basic/layout.vue index 4d53cb5d..f44b7404 100644 --- a/packages/effects/layouts/src/basic/layout.vue +++ b/packages/effects/layouts/src/basic/layout.vue @@ -228,7 +228,11 @@ const headerSlots = computed(() => { :text="preferences.app.name" :theme="showHeaderNav ? headerTheme : theme" @click="clickLogo" - /> + > + +