diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index f3e0adfb..5bda837e 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -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, diff --git a/src/views/dashboard/controls/Tab.vue b/src/views/dashboard/controls/Tab.vue index b8347f52..42c06b06 100644 --- a/src/views/dashboard/controls/Tab.vue +++ b/src/views/dashboard/controls/Tab.vue @@ -49,29 +49,30 @@ limitations under the License. --> - - + - - - + + + + +