alibaba/x-render

extra 属性传入html格式报错

gdc1998 opened this issue · 1 comments

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

  • react:17.0.71
  • form-render:2.3.6
  • table-render:
  • antd:4.24.15

2.问题描述(Bug description):extra 属性传入html格式报错

3.出现问题的 schema demo(Reproduction schema demo)

const schema = {
  properties: {
           test: {
              title: "test",
              type: "string",
              widget: "input",
              required: true,
              placeholder: '...',
              extra: <span>1</span>,
            },
            
          }
}

4.最小复现 demo(Reproduction demo)

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

schema 本质上是 JSON 对象,所以不支持 extra 直接 配置 React Node,你可以 配置 extra: 'span>1' 这种 html 字符串 模版

如果是比较复杂的 ReactNode 的话,可以通过自定义组件,组件通过 widgets 属性对象传人,extra: { widget : '自定义组件名称'}, 和 widgets 进行匹配。