From d1a6fa84dd5b122cca2ee50edc23117aa77d9163 Mon Sep 17 00:00:00 2001 From: Nevermore <15972699417@163.com> Date: Thu, 27 Jun 2024 10:14:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/template.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/store/modules/template.ts b/src/store/modules/template.ts index 43e6cb7..90647e4 100644 --- a/src/store/modules/template.ts +++ b/src/store/modules/template.ts @@ -79,7 +79,9 @@ export const useTemplatesStore = defineStore('Templates', { modifedElement() { const [ canvas ] = useCanvas() const { addHistorySnapshot } = useHistorySnapshot() - const result = canvas.tree.findOne(`#${CanvasTypes.WorkSpaceDrawType}`).toJSON() + const workspace = canvas.tree.findOne(`#${CanvasTypes.WorkSpaceDrawType}`) + if (!workspace) return + const result = workspace.toJSON() this.templates[this.templateIndex] = result addHistorySnapshot() },