From b2c22996ce62ba126703466d12993a1616b16609 Mon Sep 17 00:00:00 2001 From: baixi233 <905049652@qq.com> Date: Tue, 21 Jun 2022 11:30:59 +0800 Subject: [PATCH] fix tagsview --- src/store/modules/tabsView.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/modules/tabsView.ts b/src/store/modules/tabsView.ts index cb80f74..5d6e376 100644 --- a/src/store/modules/tabsView.ts +++ b/src/store/modules/tabsView.ts @@ -46,16 +46,16 @@ export const useTabsViewStore = defineStore({ closeLeftTabs(route) { // 关闭左侧 const index = this.tabsList.findIndex((item) => item.fullPath == route.fullPath); - this.tabsList.splice(0, index); + this.tabsList = this.tabsList.filter((item, i) => i >= index || (item?.meta?.affix ?? false)); }, closeRightTabs(route) { // 关闭右侧 const index = this.tabsList.findIndex((item) => item.fullPath == route.fullPath); - this.tabsList.splice(index + 1); + this.tabsList = this.tabsList.filter((item, i) => i <= index || (item?.meta?.affix ?? false)); }, closeOtherTabs(route) { // 关闭其他 - this.tabsList = this.tabsList.filter((item) => item.fullPath == route.fullPath); + this.tabsList = this.tabsList.filter((item) => item.fullPath == route.fullPath || (item?.meta?.affix ?? false)); }, closeCurrentTab(route) { // 关闭当前页