fix(projects): 修复菜单结构变动后路由无法进入问题

This commit is contained in:
xlsea
2025-07-24 17:36:52 +08:00
parent a1336d1536
commit f4038a2dc0

View File

@ -65,11 +65,13 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
routes.forEach(route => { routes.forEach(route => {
if (authRouteMode.value === 'dynamic') { if (authRouteMode.value === 'dynamic') {
if (route.path === '/') { if (route.path === '/' && route.children?.length) {
route.children?.forEach(child => { const child = route.children[0];
parseRouter(child); parseRouter(child);
authRoutesMap.set(child.name, child); child.name = Math.random().toString(36).slice(2, 12);
}); Object.assign(route, child);
delete route.children;
authRoutesMap.set(route.name, route);
return; return;
} }
parseRouter(route); parseRouter(route);