Merge pull request #352 from Li-0221/main

fix(components): fix homeTab closeRight and disable colseLeft
This commit is contained in:
Soybean 2024-03-18 14:56:57 +08:00 committed by GitHub
commit 51d7758903
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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;