This commit is contained in:
xingyu4j
2025-07-29 15:21:32 +08:00
60 changed files with 399 additions and 65 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/layouts",
"version": "5.5.7",
"version": "5.5.8",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -1,9 +1,11 @@
<script lang="ts" setup>
import type { SetupContext } from 'vue';
import type { RouteLocationNormalizedLoaded } from 'vue-router';
import type { MenuRecordRaw } from '@vben/types';
import { computed, useSlots, watch } from 'vue';
import { computed, onMounted, useSlots, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useRefresh } from '@vben/hooks';
import { $t, i18n } from '@vben/locales';
@@ -153,6 +155,23 @@ function clickLogo() {
emit('clickLogo');
}
function autoCollapseMenuByRouteMeta(route: RouteLocationNormalizedLoaded) {
// 只在双列模式下生效
if (
preferences.app.layout === 'sidebar-mixed-nav' &&
route.meta &&
route.meta.hideInMenu
) {
sidebarExtraVisible.value = false;
}
}
const route = useRoute();
onMounted(() => {
autoCollapseMenuByRouteMeta(route);
});
watch(
() => preferences.app.layout,
async (val) => {

View File

@@ -32,6 +32,10 @@ function useNavigation() {
return route?.meta?.openInNewWindow ?? false;
};
const resolveHref = (path: string): string => {
return router.resolve(path).href;
};
const navigation = async (path: string) => {
try {
const route = routeMetaMap.get(path);
@@ -40,7 +44,7 @@ function useNavigation() {
if (isHttpUrl(path)) {
openWindow(path, { target: '_blank' });
} else if (openInNewWindow) {
openRouteInNewWindow(path);
openRouteInNewWindow(resolveHref(path));
} else {
await router.push({
path,