feat: 修改获取路由列表

This commit is contained in:
rd
2025-07-09 16:20:56 +08:00
parent 102cfd8352
commit 5432b465ce
2 changed files with 20 additions and 16 deletions

View File

@ -93,16 +93,12 @@ export const useUserStore = defineStore('user', {
menuList.forEach((item) => {
if (item.children && item.children.length > 0) {
item.children.forEach((child: any) => {
const matchedRoute = appRoutes.find((route: any) => route.name === child.pathName);
if (matchedRoute) {
this.allowAccessRoutes.push(matchedRoute);
}
const matchedRoute = appRoutes.filter((route: any) => child.pathNames.includes(route.name));
this.allowAccessRoutes.push(...matchedRoute);
});
} else {
const matchedRoute = appRoutes.find((route: any) => route.name === item.pathName);
if (matchedRoute) {
this.allowAccessRoutes.push(matchedRoute);
}
const matchedRoute = appRoutes.filter((route: any) => item.pathNames.includes(route.name));
this.allowAccessRoutes.push(...matchedRoute);
}
});