From d28bf52683f7d9a938810b84a920d8c0b6e881b8 Mon Sep 17 00:00:00 2001 From: ~li Date: Mon, 18 Mar 2024 13:58:22 +0800 Subject: [PATCH] fix(components): fix homeTab closeRight and disable colseLeft --- src/layouts/modules/global-tab/index.vue | 3 ++- src/store/modules/tab/index.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/layouts/modules/global-tab/index.vue b/src/layouts/modules/global-tab/index.vue index ea851081..91a54100 100644 --- a/src/layouts/modules/global-tab/index.vue +++ b/src/layouts/modules/global-tab/index.vue @@ -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; diff --git a/src/store/modules/tab/index.ts b/src/store/modules/tab/index.ts index 6beb22af..b00df19f 100644 --- a/src/store/modules/tab/index.ts +++ b/src/store/modules/tab/index.ts @@ -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;