From 6de3edd4fce52989e60853cad2df17913f0b1223 Mon Sep 17 00:00:00 2001 From: JaguarJack <82664165@qq.com> Date: Tue, 2 Apr 2024 11:01:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E5=8D=A1=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/admin/stores/modules/tabs/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/resources/admin/stores/modules/tabs/index.ts b/resources/admin/stores/modules/tabs/index.ts index ec50afb..7456330 100644 --- a/resources/admin/stores/modules/tabs/index.ts +++ b/resources/admin/stores/modules/tabs/index.ts @@ -82,9 +82,15 @@ export const useNavTabStore = defineStore('nav_tabs', { }, removeTab(index: number): void { - const goPath = this.tabs[index - 1].fullPath - this.tabs = this.tabs.filter((_, idx) => idx !== index); - router.push(goPath) + 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); + router.push(goPath) + } },