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

This commit is contained in:
tnt group
2023-05-17 20:23:05 +08:00
parent 2b67bb16f3
commit 015dbb79ef
6 changed files with 24 additions and 4 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ export interface PublicConfigType {
}
filter?: string
status: StatusType
interactActions?: InteractActionsType[],
interactActions?: InteractActionsType[]
events: {
baseEvent: {
[K in BaseEvent]?: string
+6 -2
View File
@@ -27,8 +27,12 @@ export let packagesList: PackagesType = {
* @param targetData
*/
export const createComponent = async (targetData: ConfigType) => {
const { category, key } = targetData
const chart = await import(`./components/${targetData.package}/${category}/${key}/config.ts`)
const { virtualComponent, category, key } = targetData
const chart = await import(
virtualComponent
? `${virtualComponent}/config.ts`
: `./components/${targetData.package}/${category}/${key}/config.ts`
)
return new chart.default()
}