diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index c0a4c8df..2c549e18 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -31,6 +31,20 @@ export const dashboardStore = defineStore({ setLayouts(data: GridItemData[]) { this.layouts = data; }, + addWidget() { + const newWidget: GridItemData = { + x: 0, + y: 0, + w: 12, + h: 3, + i: String(this.layouts.length), + }; + this.layouts = this.layouts.map((d: GridItemData) => { + d.y = d.y + 3; + return d; + }); + this.layouts.push(newWidget); + }, }, }); diff --git a/src/views/dashboard/Edit.vue b/src/views/dashboard/Edit.vue index 556c406a..e035f0c6 100644 --- a/src/views/dashboard/Edit.vue +++ b/src/views/dashboard/Edit.vue @@ -14,7 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. -->