feat: active widget on the tab

This commit is contained in:
Qiuxia Fan
2022-01-10 14:43:07 +08:00
parent d41ace3580
commit cce5a8826c
3 changed files with 56 additions and 27 deletions

View File

@@ -105,9 +105,13 @@ export const dashboardStore = defineStore({
this.layout[idx].children?.push(i);
},
addTabWidget(tabIndex: number) {
const activedGridItem = this.activedGridItem.split("-")[0];
const idx = this.layout.findIndex(
(d: LayoutConfig) => d.i === this.activedGridItem
(d: LayoutConfig) => d.i === activedGridItem
);
if (idx < 0) {
return;
}
const { children } = this.layout[idx].children[tabIndex];
const newWidget = {
x: 0,