File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
packages/effects/layouts/src/basic Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 11<script lang="ts" setup>
22import type { SetupContext } from ' vue' ;
3+ import type { RouteLocationNormalizedLoaded } from ' vue-router' ;
34
45import 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
810import { useRefresh } from ' @vben/hooks' ;
911import { $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+
156175watch (
157176 () => preferences .app .layout ,
158177 async (val ) => {
You can’t perform that action at this time.
0 commit comments