fix:修复选项卡删除逻辑
This commit is contained in:
@@ -82,9 +82,15 @@ export const useNavTabStore = defineStore('nav_tabs', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
removeTab(index: number): void {
|
removeTab(index: number): void {
|
||||||
const goPath = this.tabs[index - 1].fullPath
|
const activeIndex = this.getActiveTabIndex()
|
||||||
|
if (index === activeIndex) {
|
||||||
|
this.tabs = this.tabs.filter((_, idx) => idx !== index);
|
||||||
|
router.push(this.tabs[index - 1].fullPath)
|
||||||
|
} else {
|
||||||
|
const goPath = activeIndex ? this.tabs[activeIndex].fullPath : this.tabs[index - 1].fullPath
|
||||||
this.tabs = this.tabs.filter((_, idx) => idx !== index);
|
this.tabs = this.tabs.filter((_, idx) => idx !== index);
|
||||||
router.push(goPath)
|
router.push(goPath)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user