修改tab刷新位置问题

This commit is contained in:
GGJ
2025-01-15 09:07:12 +08:00
parent 0cace11975
commit 0e41a5b9f1
4 changed files with 14 additions and 11 deletions

View File

@@ -39,6 +39,7 @@ export interface TabsMenuProps {
name: string;
close: boolean;
isKeepAlive: boolean;
unshift?: boolean;
}
/* TabsState */

View File

@@ -16,8 +16,14 @@ export const useTabsStore = defineStore({
actions: {
// Add Tabs
async addTabs(tabItem: TabsMenuProps) {
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
this.tabsMenuList.push(tabItem);
if (tabItem?.unshift) {
this.tabsMenuList.unshift(tabItem);
}else{
this.tabsMenuList.push(tabItem);
}
}
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
keepAliveStore.addKeepAliveName(tabItem.name);