From f0535ddf0387435e52f1496d66753718352e407c Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Fri, 25 Mar 2022 15:11:39 +0800 Subject: [PATCH] fix item --- src/store/modules/dashboard.ts | 7 +++---- src/views/dashboard/controls/Tab.vue | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index 7fa931f6..410df5d0 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -179,10 +179,9 @@ export const dashboardStore = defineStore({ activeGridItem(index: string) { this.activedGridItem = index; }, - setActiveTabIndex(index: number) { - const idx = this.layout.findIndex( - (d: LayoutConfig) => d.i === this.activedGridItem - ); + setActiveTabIndex(index: number, target?: number) { + const m = target || this.activedGridItem; + const idx = this.layout.findIndex((d: LayoutConfig) => d.i === m); if (idx < 0) { return; } diff --git a/src/views/dashboard/controls/Tab.vue b/src/views/dashboard/controls/Tab.vue index 389032ea..26d1163a 100644 --- a/src/views/dashboard/controls/Tab.vue +++ b/src/views/dashboard/controls/Tab.vue @@ -150,6 +150,7 @@ export default defineComponent({ dashboardStore.setCurrentTabItems( dashboardStore.layout[l].children[activeTabIndex.value].children ); + dashboardStore.setActiveTabIndex(activeTabIndex.value, props.data.i); } function clickTabs(e: Event, idx: number) {