Skip to content

Commit 193f5b6

Browse files
authored
Merge branch 'main' into 2025072604
2 parents 06ffdf1 + cb3f966 commit 193f5b6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

packages/effects/layouts/src/basic/layout.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<script lang="ts" setup>
22
import type { SetupContext } from 'vue';
3+
import type { RouteLocationNormalizedLoaded } from 'vue-router';
34
45
import type { MenuRecordRaw } from '@vben/types';
56
6-
import { computed, useSlots, watch } from 'vue';
7+
import { computed, onMounted, useSlots, watch } from 'vue';
8+
import { useRoute } from 'vue-router';
79
810
import { useRefresh } from '@vben/hooks';
911
import { $t, i18n } from '@vben/locales';
@@ -153,6 +155,23 @@ function clickLogo() {
153155
emit('clickLogo');
154156
}
155157
158+
function autoCollapseMenuByRouteMeta(route: RouteLocationNormalizedLoaded) {
159+
// 只在双列模式下生效
160+
if (
161+
preferences.app.layout === 'sidebar-mixed-nav' &&
162+
route.meta &&
163+
route.meta.hideInMenu
164+
) {
165+
sidebarExtraVisible.value = false;
166+
}
167+
}
168+
169+
const route = useRoute();
170+
171+
onMounted(() => {
172+
autoCollapseMenuByRouteMeta(route);
173+
});
174+
156175
watch(
157176
() => preferences.app.layout,
158177
async (val) => {

0 commit comments

Comments
 (0)