mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
optimize(projects): optimize tab deletion logic
This commit is contained in:
@ -102,10 +102,7 @@ export const useTabStore = defineStore(SetupStoreId.Tab, () => {
|
|||||||
const isRemoveActiveTab = activeTabId.value === tabId;
|
const isRemoveActiveTab = activeTabId.value === tabId;
|
||||||
|
|
||||||
// if remove the last tab, then switch to the second last tab
|
// if remove the last tab, then switch to the second last tab
|
||||||
const isLastTab = removeTabIndex === tabs.value.length - 1;
|
const nextTab = tabs.value[removeTabIndex + 1] || tabs.value[removeTabIndex - 1] || homeTab.value;
|
||||||
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);
|
||||||
|
Reference in New Issue
Block a user