|
|
|
@ -26,6 +26,10 @@ interface TabbarState { |
|
|
|
* @zh_CN 需要排除缓存的标签页 |
|
|
|
*/ |
|
|
|
excludeCachedTabs: Set<string>; |
|
|
|
/** |
|
|
|
* @zh_CN 标签右键菜单列表 |
|
|
|
*/ |
|
|
|
menuList: string[]; |
|
|
|
/** |
|
|
|
* @zh_CN 是否刷新 |
|
|
|
*/ |
|
|
|
@ -372,6 +376,14 @@ export const useTabbarStore = defineStore('core-tabbar', { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* @zh_CN 更新菜单列表 |
|
|
|
* @param list |
|
|
|
*/ |
|
|
|
setMenuList(list: string[]) { |
|
|
|
this.menuList = list; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* @zh_CN 设置标签页标题 |
|
|
|
* @param tab |
|
|
|
@ -388,7 +400,6 @@ export const useTabbarStore = defineStore('core-tabbar', { |
|
|
|
await this.updateCacheTabs(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
setUpdateTime() { |
|
|
|
this.updateTime = Date.now(); |
|
|
|
}, |
|
|
|
@ -406,6 +417,7 @@ export const useTabbarStore = defineStore('core-tabbar', { |
|
|
|
this.tabs.splice(newIndex, 0, currentTab); |
|
|
|
this.dragEndIndex = this.dragEndIndex + 1; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* @zh_CN 切换固定标签页 |
|
|
|
* @param tab |
|
|
|
@ -439,7 +451,6 @@ export const useTabbarStore = defineStore('core-tabbar', { |
|
|
|
// 交换位置重新排序
|
|
|
|
await this.sortTabs(index, newIndex); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据当前打开的选项卡更新缓存 |
|
|
|
*/ |
|
|
|
@ -480,6 +491,9 @@ export const useTabbarStore = defineStore('core-tabbar', { |
|
|
|
getExcludeCachedTabs(): string[] { |
|
|
|
return [...this.excludeCachedTabs]; |
|
|
|
}, |
|
|
|
getMenuList(): string[] { |
|
|
|
return this.menuList; |
|
|
|
}, |
|
|
|
getTabs(): TabDefinition[] { |
|
|
|
const normalTabs = this.tabs.filter((tab) => !isAffixTab(tab)); |
|
|
|
return [...this.affixTabs, ...normalTabs].filter(Boolean); |
|
|
|
@ -496,6 +510,17 @@ export const useTabbarStore = defineStore('core-tabbar', { |
|
|
|
cachedTabs: new Set(), |
|
|
|
dragEndIndex: 0, |
|
|
|
excludeCachedTabs: new Set(), |
|
|
|
menuList: [ |
|
|
|
'close', |
|
|
|
'affix', |
|
|
|
'maximize', |
|
|
|
'reload', |
|
|
|
'open-in-new-window', |
|
|
|
'close-left', |
|
|
|
'close-right', |
|
|
|
'close-other', |
|
|
|
'close-all', |
|
|
|
], |
|
|
|
renderRouteView: true, |
|
|
|
tabs: [], |
|
|
|
updateTime: Date.now(), |
|
|
|
|