From 8982f147dc73b91838e3ab93d92a46199a9c92fc Mon Sep 17 00:00:00 2001 From: wisonic Date: Tue, 16 Jul 2024 14:42:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E6=8F=92=E4=BB=B6=E5=9C=A8=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/utils/canvasUtils.ts | 7 +++++-- core/core-frontend/src/views/data-visualization/index.vue | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index 927ac91376..afc898719c 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -46,7 +46,7 @@ export function findDragComponent(componentInfo) { return findNewComponent(componentName, innerType) } -export function findNewComponent(componentName, innerType, isPlugin?: boolean) { +export function findNewComponent(componentName, innerType, staticMap?) { let newComponent componentList.forEach(comp => { if (comp.component === componentName || comp.component === innerType) { @@ -69,7 +69,10 @@ export function findNewComponent(componentName, innerType, isPlugin?: boolean) { newComponent.name = viewConfig?.title newComponent.label = viewConfig?.title newComponent.render = viewConfig?.render - newComponent.isPlugin = !!isPlugin + newComponent.isPlugin = !!staticMap + if (newComponent.isPlugin) { + newComponent.staticMap = staticMap + } } return newComponent } diff --git a/core/core-frontend/src/views/data-visualization/index.vue b/core/core-frontend/src/views/data-visualization/index.vue index d0d59e7e50..8319f8820c 100644 --- a/core/core-frontend/src/views/data-visualization/index.vue +++ b/core/core-frontend/src/views/data-visualization/index.vue @@ -116,10 +116,10 @@ const contentStyle = computed(() => { // 通过实时监听的方式直接添加组件 const handleNew = newComponentInfo => { - const { componentName, innerType, isPlugin } = newComponentInfo + const { componentName, innerType, staticMap } = newComponentInfo if (componentName) { const { width, height, scale } = canvasStyleData.value - const component = findNewComponent(componentName, innerType, isPlugin) + const component = findNewComponent(componentName, innerType, staticMap) component.style.top = ((height - component.style.height) * scale) / 200 component.style.left = ((width - component.style.width) * scale) / 200 component.id = guid()