alibaba / x-render

🚴‍♀️ 阿里 - 很易用的中后台「表单 / 表格 / 图表」解决方案
https://xrender.fun
6.96k stars 986 forks source link

type 为 `object` 类型自定义组件没有接收到 `value` 与 `onChange` 属性 #1453

Closed mov-78 closed 7 months ago

mov-78 commented 8 months ago

1.依赖仓库的版本(Dependencies versions)

2.问题描述(Bug description)

在为 typeobject 的字段注册自定义组件时,自定义组件没有接收到 valueonChange props。

3.最小复现 demo(Reproduction demo)

demo

object 类型的自定义组件接收不到 valueonChange 属性:

image

而其他非对象类型,例如 string 则可以接受到:

image
lhbxs commented 7 months ago

2.x 对于你这样的结构会视为容器组件进行递归渲染

if (schema?.properties && schema?.widgetType !== 'field') { child = RenderCore({ schema, parentPath: path, rootPath }) }

schema 增加一个 widgetType:'field'