feat: 插件页面支持slot

This commit is contained in:
jxxghp
2024-04-17 22:55:45 +08:00
parent 6350c7e9e6
commit 9ff212c94d

View File

@@ -7,6 +7,7 @@ interface RenderProps {
text: string
html: string
content?: any
slots?: any
props?: any
}
@@ -22,6 +23,7 @@ const formItem = ref<RenderProps>(elementProps.config ?? {
html: '',
props: {},
content: [],
slots: {},
})
</script>
@@ -32,6 +34,15 @@ const formItem = ref<RenderProps>(elementProps.config ?? {
v-bind="formItem.props"
>
{{ formItem.text }}
<template v-for="(content, name) in (formItem.slots || [])" :key="name" v-slot:[name]="{_props}">
<slot :name="name" v-bind="_props">
<PageRender
v-for="(slotItem, slotIndex) in (content || [])"
:key="slotIndex"
:config="slotItem"
/>
</slot>
</template>
<PageRender
v-for="(innerItem, innerIndex) in (formItem.content || [])"
:key="innerIndex"