|
@@ -119,7 +119,7 @@ export const useMultipleTabStore = defineStore({
|
|
|
},
|
|
|
|
|
|
async addTab(route: RouteLocationNormalized) {
|
|
|
- const { path, name, fullPath, params, query } = getRawRoute(route);
|
|
|
+ const { path, name, fullPath, params, query, meta } = getRawRoute(route);
|
|
|
|
|
|
if (
|
|
|
path === PageEnum.ERROR_PAGE ||
|
|
@@ -149,6 +149,21 @@ export const useMultipleTabStore = defineStore({
|
|
|
this.tabList.splice(updateIndex, 1, curTab);
|
|
|
} else {
|
|
|
|
|
|
+
|
|
|
+ const dynamicLevel = meta?.dynamicLevel ?? -1;
|
|
|
+ if (dynamicLevel > 0) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const realPath = meta?.realPath ?? '';
|
|
|
+
|
|
|
+
|
|
|
+ if (this.tabList.filter((e) => e.meta?.realPath ?? '' === realPath).length >= 5) {
|
|
|
+
|
|
|
+ const index = this.tabList.findIndex((item) => item.meta.realPath === realPath);
|
|
|
+ index !== -1 && this.tabList.splice(index, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
this.tabList.push(route);
|
|
|
}
|
|
|
this.updateCacheTab();
|