fix(components): fix homeTab closeRight and disable colseLeft

This commit is contained in:
~li 2024-03-18 13:58:22 +08:00
parent 455e48f792
commit d28bf52683
2 changed files with 8 additions and 1 deletions

View File

@ -73,7 +73,8 @@ function getContextMenuDisabledKeys(tabId: string) {
const disabledKeys: App.Global.DropdownKey[] = [];
if (tabStore.isTabRetain(tabId)) {
disabledKeys.push('closeCurrent');
const homeDisable: App.Global.DropdownKey[] = ['closeCurrent', 'closeLeft'];
disabledKeys.push(...homeDisable);
}
return disabledKeys;

View File

@ -192,6 +192,12 @@ export const useTabStore = defineStore(SetupStoreId.Tab, () => {
* @param tabId
*/
async function clearRightTabs(tabId: string) {
const isHomeTab = tabId === homeTab.value?.id;
if (isHomeTab) {
clearTabs();
return;
}
const tabIds = tabs.value.map(tab => tab.id);
const index = tabIds.indexOf(tabId);
if (index === -1) return;