From 01024e6a2bb42dd91de31a322e9b5dea2816be4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=98=89=E8=B1=AA?= <42510293+ziyujiahao@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:40:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF=E3=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=97=B6=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=E5=BC=82=E5=B8=B8=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=89=93=E5=8D=B0=20(#16685)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/data-visualization/canvas/Shape.vue | 6 ++++-- .../src/store/modules/data-visualization/compose.ts | 3 +++ .../components/views/components/ChartComponentG2Plot.vue | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index a7a750fbea..b87b226567 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -735,8 +735,10 @@ const handleMouseDownOnPoint = (point, e) => { } // 获取画布位移信息 - const editorRectInfo = editorMap.value[canvasId.value].getBoundingClientRect() - + const editorRectInfo = editorMap.value[canvasId.value]?.getBoundingClientRect() + if (!editorRectInfo) { + reutrn + } // 获取 point 与实际拖动基准点的差值 const pointRect = e.target.getBoundingClientRect() // 当前点击圆点相对于画布的中心坐标 diff --git a/core/core-frontend/src/store/modules/data-visualization/compose.ts b/core/core-frontend/src/store/modules/data-visualization/compose.ts index e3780f243c..c1b23e8b41 100644 --- a/core/core-frontend/src/store/modules/data-visualization/compose.ts +++ b/core/core-frontend/src/store/modules/data-visualization/compose.ts @@ -225,6 +225,9 @@ export const composeStore = defineStore('compose', { decompose() { const canvasId = curComponent.value.canvasId const editor = this.editorMap[canvasId] + if (!editor) { + return + } const parentStyle = { ...curComponent.value.style } const components = curComponent.value.propValue const editorRect = editor.getBoundingClientRect() diff --git a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue index 3a02ffe7ac..06806e4e05 100644 --- a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue +++ b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue @@ -691,7 +691,7 @@ const canvas2Picture = (pictureData, online) => { imgDom.style['z-index'] = '2' imgDom.classList.add('prepare-picture-img') imgDom.src = pictureData - mapDom.appendChild(imgDom) + mapDom?.appendChild(imgDom) } const preparePicture = id => { if (id !== curView?.id) {