Merge pull request #414 from paynezhuang/fix/tab_fixedIndex
fix(projects): fix tab fixedIndex as null case
This commit is contained in:
commit
c89e00d194
@ -17,10 +17,10 @@ export function getAllTabs(tabs: App.Global.Tab[], homeTab?: App.Global.Tab) {
|
|||||||
const filterHomeTabs = tabs.filter(tab => tab.id !== homeTab.id);
|
const filterHomeTabs = tabs.filter(tab => tab.id !== homeTab.id);
|
||||||
|
|
||||||
const fixedTabs = filterHomeTabs
|
const fixedTabs = filterHomeTabs
|
||||||
.filter(tab => tab.fixedIndex !== undefined)
|
.filter(tab => tab.fixedIndex !== undefined && tab.fixedIndex !== null)
|
||||||
.sort((a, b) => a.fixedIndex! - b.fixedIndex!);
|
.sort((a, b) => a.fixedIndex! - b.fixedIndex!);
|
||||||
|
|
||||||
const remainTabs = filterHomeTabs.filter(tab => tab.fixedIndex === undefined);
|
const remainTabs = filterHomeTabs.filter(tab => tab.fixedIndex === undefined || tab.fixedIndex === null);
|
||||||
|
|
||||||
const allTabs = [homeTab, ...fixedTabs, ...remainTabs];
|
const allTabs = [homeTab, ...fixedTabs, ...remainTabs];
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ export function extractTabsByAllRoutes(router: Router, tabs: App.Global.Tab[]) {
|
|||||||
* @param tabs
|
* @param tabs
|
||||||
*/
|
*/
|
||||||
export function getFixedTabs(tabs: App.Global.Tab[]) {
|
export function getFixedTabs(tabs: App.Global.Tab[]) {
|
||||||
return tabs.filter(tab => tab.fixedIndex !== undefined);
|
return tabs.filter(tab => tab.fixedIndex !== undefined && tab.fixedIndex !== null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
2
src/typings/app.d.ts
vendored
2
src/typings/app.d.ts
vendored
@ -198,7 +198,7 @@ declare namespace App {
|
|||||||
/** The tab route full path */
|
/** The tab route full path */
|
||||||
fullPath: string;
|
fullPath: string;
|
||||||
/** The tab fixed index */
|
/** The tab fixed index */
|
||||||
fixedIndex?: number;
|
fixedIndex?: number | null;
|
||||||
/**
|
/**
|
||||||
* Tab icon
|
* Tab icon
|
||||||
*
|
*
|
||||||
|
2
src/typings/router.d.ts
vendored
2
src/typings/router.d.ts
vendored
@ -58,7 +58,7 @@ declare module 'vue-router' {
|
|||||||
/** By default, the same route path will use one tab, if set to true, it will use multiple tabs */
|
/** By default, the same route path will use one tab, if set to true, it will use multiple tabs */
|
||||||
multiTab?: boolean;
|
multiTab?: boolean;
|
||||||
/** If set, the route will be fixed in tabs, and the value is the order of fixed tabs */
|
/** If set, the route will be fixed in tabs, and the value is the order of fixed tabs */
|
||||||
fixedIndexInTab?: number;
|
fixedIndexInTab?: number | null;
|
||||||
/** if set query parameters, it will be automatically carried when entering the route */
|
/** if set query parameters, it will be automatically carried when entering the route */
|
||||||
query?: Record<string, string>;
|
query?: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user