Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(route): meta declaration expand not working
  • Loading branch information
RSS1102 committed Sep 28, 2025
commit 00225121b73ff70db2f7cc0bbbb2f738bd5a25c2
7 changes: 6 additions & 1 deletion src/layouts/components/SideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ const getExpanded = () => {
const parts = path.split('/').slice(1);
const result = parts.map((_, index) => `/${parts.slice(0, index + 1).join('/')}`);

expanded.value = menuAutoCollapsed.value ? result : union(result, expanded.value);
const allRoutes = router.getRoutes();
const allRoutesExpanded = allRoutes.filter((item) => item.meta?.expanded).map((item) => item.path);

expanded.value = menuAutoCollapsed.value
? union(result, allRoutesExpanded)
: union(result, expanded.value, allRoutesExpanded);
};

watch(
Expand Down