Merge branch 'main' into 2025072604

pull/183/MERGE
Jin Mao 2025-07-28 15:53:04 +08:00 committed by GitHub
commit 193f5b6512
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 1 deletions

View File

@ -1,9 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { SetupContext } from 'vue'; import type { SetupContext } from 'vue';
import type { RouteLocationNormalizedLoaded } from 'vue-router';
import type { MenuRecordRaw } from '@vben/types'; 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 { useRefresh } from '@vben/hooks';
import { $t, i18n } from '@vben/locales'; import { $t, i18n } from '@vben/locales';
@ -153,6 +155,23 @@ function clickLogo() {
emit('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( watch(
() => preferences.app.layout, () => preferences.app.layout,
async (val) => { async (val) => {