perf: the routeModule can ignore the layou configuration without writing

This commit is contained in:
vben
2020-11-01 11:55:18 +08:00
parent b36d9486a5
commit 4c658f4868
5 changed files with 26 additions and 10 deletions

View File

@@ -87,8 +87,13 @@ export async function getFlatChildrenMenus(children: Menu[]) {
function basicFilter(routes: RouteRecordNormalized[]) {
return (menu: Menu) => {
const matchRoute = routes.find((route) => {
if (route.meta && route.meta.carryParam) {
return pathToRegexp(route.path).test(menu.path);
if (route.meta) {
if (route.meta.carryParam) {
return pathToRegexp(route.path).test(menu.path);
}
if (route.meta.ignoreAuth) {
return false;
}
}
return route.path === menu.path;
});