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()