x-render icon indicating copy to clipboard operation
x-render copied to clipboard

自定义组件type 为array 自定义组件无法拿到item的schema

Open gdc1998 opened this issue 3 years ago • 1 comments

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

  • react:
  • form-render:1.13.8
  • table-render:
  • antd:

2.问题描述(Bug description): 自定义组件type 为array 自定义组件无法拿到item的schema

3.最小复现 demo(Reproduction demo): { "type": "object", "properties": { "list2_5vj0Vf": { "title": "数组", "type": "array", "widget": "ITableList", "items": { "type": "object", "properties": { "input_1FcGV6": { "title": "输入框", "type": "string", "props": {} }, "input_lXqxxe": { "title": "输入框", "type": "string", "props": {} } } }, "props": {} } }, "labelWidth": 120, "displayType": "row" }

form-render demo https://codesandbox.io/s/unruffled-flower-jl78h table-render demo https://codesandbox.io/s/sweet-euler-bdoty fr-generator demo https://codesandbox.io/s/s13sh

gdc1998 avatar Jun 29 '22 07:06 gdc1998

@gdc1998 你好 自定义组件里可以通过props.addons的获取全部信息的,schema就是用getSchemaByPath方法拿到。 比如说你举例的ITableList,因为是一个array,所以需要通过list2_5vj0Vf[]就可以拿到,完整的写法见下方

props?.addons?.getSchemaByPath('list2_5vj0Vf[].input_1FcGV6')

psycholali avatar Jul 15 '22 06:07 psycholali