This commit is contained in:
Qiuxia Fan 2022-03-25 15:11:39 +08:00
parent 5593416257
commit f0535ddf03
2 changed files with 4 additions and 4 deletions

View File

@ -179,10 +179,9 @@ export const dashboardStore = defineStore({
activeGridItem(index: string) { activeGridItem(index: string) {
this.activedGridItem = index; this.activedGridItem = index;
}, },
setActiveTabIndex(index: number) { setActiveTabIndex(index: number, target?: number) {
const idx = this.layout.findIndex( const m = target || this.activedGridItem;
(d: LayoutConfig) => d.i === this.activedGridItem const idx = this.layout.findIndex((d: LayoutConfig) => d.i === m);
);
if (idx < 0) { if (idx < 0) {
return; return;
} }

View File

@ -150,6 +150,7 @@ export default defineComponent({
dashboardStore.setCurrentTabItems( dashboardStore.setCurrentTabItems(
dashboardStore.layout[l].children[activeTabIndex.value].children dashboardStore.layout[l].children[activeTabIndex.value].children
); );
dashboardStore.setActiveTabIndex(activeTabIndex.value, props.data.i);
} }
function clickTabs(e: Event, idx: number) { function clickTabs(e: Event, idx: number) {