fix plugin form

This commit is contained in:
jxxghp
2023-07-24 11:36:21 +08:00
parent 7d5e30a5ca
commit 74aca36e71

View File

@@ -4,21 +4,25 @@ import { type PropType, ref } from 'vue'
// 组件配置
interface RenderProps {
component: string
content: any
props: any
content?: any
props?: any
}
// 输入参数
const elementProps = defineProps({
config: Array as PropType<RenderProps[]>,
config: Object as PropType<RenderProps>,
})
// 配置表单
const formItems = ref(elementProps.config)
const formItem = ref<RenderProps>(elementProps.config || {
component: 'div',
props: {},
content: [],
})
</script>
<template>
<Component :is="item.component" v-for="(item, index) in formItems" :key="index" v-bind="item.props">
<FormRender v-for="(innerItem, innerIndex) in (item.content || [])" :key="innerIndex" :config="innerItem" />
<Component :is="formItem.component" v-bind="formItem.props">
<FormRender v-for="(innerItem, innerIndex) in (formItem.content || [])" :key="innerIndex" :config="innerItem" />
</Component>
</template>