add support for Form slots in FormSchema config

example:
componentsProps{
	slots:{
		append: ()=>h('span',null,'appendd slot')
	}
}
This commit is contained in:
13636643269
2022-09-03 10:38:00 +08:00
parent 0c60904918
commit 5cefb7286d

View File

@@ -181,6 +181,10 @@ export default defineComponent({
item?.componentProps?.options
) {
slotsMap.default = () => renderOptions(item)
} else if (item.componentProps?.slots) {
// 非Options的组件通过slots配置渲染组件
// 例如 componentProps{slots:{append: ()=>h('span',null,'appendComponent')}}
Object.entries(item.componentProps.slots).forEach((slot) => (slotsMap[slot[0]] = slot[1]))
}
const formItemSlots: Recordable = setFormItemSlots(slots, item.field)