mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-10-13 05:13:41 +08:00
fix(projects): fix repeat home tab
This commit is contained in:
@@ -14,9 +14,13 @@ export function getAllTabs(tabs: App.Global.Tab[], homeTab?: App.Global.Tab) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const fixedTabs = tabs.filter(tab => tab.fixedIndex !== undefined).sort((a, b) => a.fixedIndex! - b.fixedIndex!);
|
||||
const filterHomeTabs = tabs.filter(tab => tab.id !== homeTab.id);
|
||||
|
||||
const remainTabs = tabs.filter(tab => tab.fixedIndex === undefined);
|
||||
const fixedTabs = filterHomeTabs
|
||||
.filter(tab => tab.fixedIndex !== undefined)
|
||||
.sort((a, b) => a.fixedIndex! - b.fixedIndex!);
|
||||
|
||||
const remainTabs = filterHomeTabs.filter(tab => tab.fixedIndex === undefined);
|
||||
|
||||
const allTabs = [homeTab, ...fixedTabs, ...remainTabs];
|
||||
|
||||
@@ -154,12 +158,12 @@ export function filterTabsByIds(tabIds: string[], tabs: App.Global.Tab[]) {
|
||||
}
|
||||
|
||||
/**
|
||||
* filter tabs by all routes
|
||||
* extract tabs by all routes
|
||||
*
|
||||
* @param router
|
||||
* @param tabs
|
||||
*/
|
||||
export function filterTabsByAllRoutes(router: Router, tabs: App.Global.Tab[]) {
|
||||
export function extractTabsByAllRoutes(router: Router, tabs: App.Global.Tab[]) {
|
||||
const routes = router.getRoutes();
|
||||
|
||||
const routeNames = routes.map(route => route.name);
|
||||
|
Reference in New Issue
Block a user