|
|
|
@ -125,7 +125,7 @@ export const useMultipleTabStore = defineStore({
@@ -125,7 +125,7 @@ export const useMultipleTabStore = defineStore({
|
|
|
|
|
this.tabList.splice(updateIndex, 1, curTab); |
|
|
|
|
// 添加选项卡
|
|
|
|
|
} else this.tabList.push(route); |
|
|
|
|
this.updateCacheTab(); |
|
|
|
|
await this.updateCacheTab(); |
|
|
|
|
cacheTab && Persistent.setLocal(MULTIPLE_TABS_KEY, this.tabList); |
|
|
|
|
}, |
|
|
|
|
/** 关闭标签页 */ |
|
|
|
@ -173,7 +173,7 @@ export const useMultipleTabStore = defineStore({
@@ -173,7 +173,7 @@ export const useMultipleTabStore = defineStore({
|
|
|
|
|
/** 标签新增与删除回调处理,用于关闭标签页 */ |
|
|
|
|
async closeTabByKey(key: string, router: Router) { |
|
|
|
|
const index = this.tabList.findIndex((item) => (item.fullPath || item.path) === key); |
|
|
|
|
index !== -1 && this.closeTab(this.tabList[index], router); |
|
|
|
|
index !== -1 && await this.closeTab(this.tabList[index], router); |
|
|
|
|
}, |
|
|
|
|
/** 对选项卡进行排序 */ |
|
|
|
|
async sortTabs(oldIndex: number, newIndex: number) { |
|
|
|
@ -192,9 +192,9 @@ export const useMultipleTabStore = defineStore({
@@ -192,9 +192,9 @@ export const useMultipleTabStore = defineStore({
|
|
|
|
|
const affix = item?.meta?.affix ?? false; |
|
|
|
|
if (!affix) pathList.push(item.fullPath); |
|
|
|
|
} |
|
|
|
|
this.bulkCloseTabs(pathList); |
|
|
|
|
await this.bulkCloseTabs(pathList); |
|
|
|
|
} |
|
|
|
|
this.updateCacheTab(); |
|
|
|
|
await this.updateCacheTab(); |
|
|
|
|
handleGotoPage(router); |
|
|
|
|
}, |
|
|
|
|
/** 关闭左侧标签并跳转 */ |
|
|
|
@ -207,9 +207,9 @@ export const useMultipleTabStore = defineStore({
@@ -207,9 +207,9 @@ export const useMultipleTabStore = defineStore({
|
|
|
|
|
const affix = item?.meta?.affix ?? false; |
|
|
|
|
if (!affix) pathList.push(item.fullPath); |
|
|
|
|
} |
|
|
|
|
this.bulkCloseTabs(pathList); |
|
|
|
|
await this.bulkCloseTabs(pathList); |
|
|
|
|
} |
|
|
|
|
this.updateCacheTab(); |
|
|
|
|
await this.updateCacheTab(); |
|
|
|
|
handleGotoPage(router); |
|
|
|
|
}, |
|
|
|
|
/** 关闭全部标签并跳转 */ |
|
|
|
@ -230,8 +230,8 @@ export const useMultipleTabStore = defineStore({
@@ -230,8 +230,8 @@ export const useMultipleTabStore = defineStore({
|
|
|
|
|
if (!affix) pathList.push(closeItem.fullPath); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.bulkCloseTabs(pathList); |
|
|
|
|
this.updateCacheTab(); |
|
|
|
|
await this.bulkCloseTabs(pathList); |
|
|
|
|
await this.updateCacheTab(); |
|
|
|
|
handleGotoPage(router); |
|
|
|
|
}, |
|
|
|
|
/** 批量关闭标签页 */ |
|
|
|
@ -254,8 +254,8 @@ export const useMultipleTabStore = defineStore({
@@ -254,8 +254,8 @@ export const useMultipleTabStore = defineStore({
|
|
|
|
|
findTab.path = fullPath; |
|
|
|
|
await this.updateCacheTab(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 需要在设置之外使用
|
|
|
|
|