feat: 在通过拖拽、双击、搜索不同方式动态创建组件时,支持创建虚拟组件,并根据预设值和预设标题,初始化组件

This commit is contained in:
tnt group
2023-05-17 20:23:05 +08:00
parent c7b2daa0b8
commit 31ed863d53
6 changed files with 24 additions and 4 deletions
@@ -92,6 +92,10 @@ const dblclickHandle = async (item: ConfigType) => {
componentInstall(item.conKey, fetchConfigComponent(item))
// 创建新图表组件
let newComponent: CreateComponentType = await createComponent(item)
if (item.virtualComponent) {
item.dataset && (newComponent.option.dataset = item.dataset)
newComponent.chartConfig.title = item.title
}
// 添加
chartEditStore.addComponentList(newComponent, false, true)
// 选中
@@ -153,6 +153,10 @@ const selectChartHandle = async (item: ConfigType) => {
componentInstall(item.conKey, fetchConfigComponent(item))
// 创建新图表组件
let newComponent: CreateComponentType = await createComponent(item)
if (item.virtualComponent) {
item.dataset && (newComponent.option.dataset = item.dataset)
newComponent.chartConfig.title = item.title
}
// 添加
chartEditStore.addComponentList(newComponent, false, true)
// 选中