From 9dc9dd3672e14fd40a08b0352557bc16adbab020 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Thu, 13 Jan 2022 12:42:20 +0800 Subject: [PATCH] fix: apply config --- src/store/modules/dashboard.ts | 14 +++++++++++++- src/views/dashboard/Edit.vue | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index 12e03df8..5fb95524 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -139,7 +139,19 @@ export const dashboardStore = defineStore({ this.entity = type; }, setConfigs(param: { [key: string]: unknown }) { - const index = this.layout.findIndex((d: LayoutConfig) => d.i === param.i); + const actived = this.activedGridItem.split("-"); + const index = this.layout.findIndex( + (d: LayoutConfig) => actived[0] === d.i + ); + + if (actived.length === 3) { + this.layout[index].children[actived[1]].children[actived[2]] = { + ...this.layout[index], + ...param, + }; + this.selectedGrid = this.layout[index]; + return; + } this.layout[index] = { ...this.layout[index], ...param, diff --git a/src/views/dashboard/Edit.vue b/src/views/dashboard/Edit.vue index 5dda9a57..324ff04a 100644 --- a/src/views/dashboard/Edit.vue +++ b/src/views/dashboard/Edit.vue @@ -64,7 +64,8 @@ function handleClick(e: any) {