fix
This commit is contained in:
parent
f56bcdba16
commit
d24c5d0737
@ -109,3 +109,23 @@ export function handleRoutes(routers, pathUrl = '') {
|
||||
item.path = path.resolve(pathUrl, item.path);
|
||||
});
|
||||
}
|
||||
|
||||
export function findParentRoute(routes, targetPath) {
|
||||
for (const route of routes) {
|
||||
if (route.children) {
|
||||
for (const child of route.children) {
|
||||
if (child.path === targetPath) {
|
||||
return route;
|
||||
}
|
||||
if (child.children) {
|
||||
for (const grandChild of child.children) {
|
||||
if (grandChild.path === targetPath) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user