mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-27 05:36:43 +08:00
optimize(projects): optimize tab deletion logic
This commit is contained in:
parent
2ed0b6484c
commit
7ac2a6ce2d
@ -100,7 +100,12 @@ export const useTabStore = defineStore(SetupStoreId.Tab, () => {
|
|||||||
|
|
||||||
const removedTabRouteKey = tabs.value[removeTabIndex].routeKey;
|
const removedTabRouteKey = tabs.value[removeTabIndex].routeKey;
|
||||||
const isRemoveActiveTab = activeTabId.value === tabId;
|
const isRemoveActiveTab = activeTabId.value === tabId;
|
||||||
const nextTab = tabs.value[removeTabIndex + 1] || homeTab.value;
|
|
||||||
|
// if remove the last tab, then switch to the second last tab
|
||||||
|
const isLastTab = removeTabIndex === tabs.value.length - 1;
|
||||||
|
const nextTab = isLastTab
|
||||||
|
? tabs.value[removeTabIndex - 1] || homeTab.value
|
||||||
|
: tabs.value[removeTabIndex + 1] || homeTab.value;
|
||||||
|
|
||||||
// remove tab
|
// remove tab
|
||||||
tabs.value.splice(removeTabIndex, 1);
|
tabs.value.splice(removeTabIndex, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user