Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra 属性传入html格式报错 #1450

Closed
gdc1998 opened this issue Dec 8, 2023 · 1 comment
Closed

extra 属性传入html格式报错 #1450

gdc1998 opened this issue Dec 8, 2023 · 1 comment
Assignees

Comments

@gdc1998
Copy link

gdc1998 commented Dec 8, 2023

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

@lhbxs
Copy link
Collaborator

lhbxs commented Dec 19, 2023

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

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

@lhbxs lhbxs closed this as completed Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants