add support for Form slots in FormSchema config
example:
componentsProps{
slots:{
append: ()=>h('span',null,'appendd slot')
}
}
This commit is contained in:
@@ -181,6 +181,10 @@ export default defineComponent({
|
|||||||
item?.componentProps?.options
|
item?.componentProps?.options
|
||||||
) {
|
) {
|
||||||
slotsMap.default = () => renderOptions(item)
|
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)
|
const formItemSlots: Recordable = setFormItemSlots(slots, item.field)
|
||||||
|
|||||||
Reference in New Issue
Block a user