mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 在通过拖拽、双击、搜索不同方式动态创建组件时,支持创建虚拟组件,并根据预设值和预设标题,初始化组件
This commit is contained in:
@@ -32,6 +32,10 @@ export const dragHandle = async (e: DragEvent) => {
|
||||
|
||||
// 创建新图表组件
|
||||
let newComponent: CreateComponentType = await createComponent(dropData)
|
||||
if (dropData.virtualComponent) {
|
||||
dropData.dataset && (newComponent.option.dataset = dropData.dataset)
|
||||
newComponent.chartConfig.title = dropData.title
|
||||
}
|
||||
|
||||
setComponentPosition(newComponent, e.offsetX - newComponent.attr.w / 2, e.offsetY - newComponent.attr.h / 2)
|
||||
chartEditStore.addComponentList(newComponent, false, true)
|
||||
|
||||
Reference in New Issue
Block a user