feat(projects): filter tabs which are not in routes

This commit is contained in:
Soybean
2024-01-20 19:58:58 +08:00
parent b4f3dd2f7a
commit f59f34884c
3 changed files with 22 additions and 9 deletions

View File

@@ -126,6 +126,20 @@ export function filterTabsByIds(tabIds: string[], tabs: App.Global.Tab[]) {
return tabs.filter(tab => !tabIds.includes(tab.id));
}
/**
* filter tabs by all routes
*
* @param router
* @param tabs
*/
export function filterTabsByAllRoutes(router: Router, tabs: App.Global.Tab[]) {
const routes = router.getRoutes();
const routeNames = routes.map(route => route.name);
return tabs.filter(tab => routeNames.includes(tab.routeKey));
}
/**
* Get fixed tabs
*