diff --git a/packages/materials/src/libs/page-tab/index.vue b/packages/materials/src/libs/page-tab/index.vue
index 0c0c6995..8c7b98d2 100644
--- a/packages/materials/src/libs/page-tab/index.vue
+++ b/packages/materials/src/libs/page-tab/index.vue
@@ -63,7 +63,7 @@ function handleClose() {
-
+
diff --git a/src/store/modules/tab/index.ts b/src/store/modules/tab/index.ts
index 730abe05..e6fe927c 100644
--- a/src/store/modules/tab/index.ts
+++ b/src/store/modules/tab/index.ts
@@ -10,7 +10,6 @@ import { SetupStoreId } from '@/enum';
import { useThemeStore } from '../theme';
import {
extractTabsByAllRoutes,
- filterTabsById,
filterTabsByIds,
findTabByRouteName,
getAllTabs,
@@ -96,23 +95,15 @@ export const useTabStore = defineStore(SetupStoreId.Tab, () => {
* @param tabId Tab id
*/
async function removeTab(tabId: string) {
+ const removeTabIndex = tabs.value.findIndex(tab => tab.id === tabId);
+ if (removeTabIndex === -1) return;
+
const isRemoveActiveTab = activeTabId.value === tabId;
- const updatedTabs = filterTabsById(tabId, tabs.value);
+ const nextTab = tabs.value[removeTabIndex + 1] || homeTab.value;
- function update() {
- tabs.value = updatedTabs;
- }
-
- if (!isRemoveActiveTab) {
- update();
- return;
- }
-
- const activeTab = updatedTabs.at(-1) || homeTab.value;
-
- if (activeTab) {
- await switchRouteByTab(activeTab);
- update();
+ tabs.value.splice(removeTabIndex, 1);
+ if (isRemoveActiveTab && nextTab) {
+ await switchRouteByTab(nextTab);
}
}