fix(@vben/tabs-ui): modified fixed and unfixed logic, fixed #4640 (#4709)

* fix: modified fixed and unfixed logic, fixed #4640

* fix: modified fixed and unfixed logic, fixed #4640
pull/48/MERGE
pingsanddoss 2024-10-22 14:59:46 +08:00 committed by GitHub
parent 7f4c733fa3
commit f60796f961
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -312,6 +312,14 @@ export const useTabbarStore = defineStore('core-tabbar', {
// this.addTab(tab);
this.tabs.splice(index, 1, tab);
}
// 过滤固定tabs后面更改affixTabOrder的值的话可能会有问题目前行464排序affixTabs没有设置值
const affixTabs = this.tabs.filter((tab) => isAffixTab(tab));
// 获得固定tabs的index
const newIndex = affixTabs.findIndex(
(item) => getTabPath(item) === getTabPath(tab),
);
// 交换位置重新排序
await this.sortTabs(index, newIndex);
},
/**
@ -419,6 +427,12 @@ export const useTabbarStore = defineStore('core-tabbar', {
// this.addTab(tab);
this.tabs.splice(index, 1, tab);
}
// 过滤固定tabs后面更改affixTabOrder的值的话可能会有问题目前行464排序affixTabs没有设置值
const affixTabs = this.tabs.filter((tab) => isAffixTab(tab));
// 获得固定tabs的index,使用固定tabs的下一个位置也就是活动tabs的第一个位置
const newIndex = affixTabs.length;
// 交换位置重新排序
await this.sortTabs(index, newIndex);
},
/**