Explorar o código

Merge pull request #160 from x19990416/master

增加对 FormSchema slots 属性支持的优化
Archer %!s(int64=2) %!d(string=hai) anos
pai
achega
6fbf260468
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      src/components/Form/src/Form.vue

+ 4 - 0
src/components/Form/src/Form.vue

@@ -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)