alibaba / x-render

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

FormRender使用description导致rules校验时提示语从title变成key了 #1463

Closed RyzenPan closed 7 months ago

RyzenPan commented 7 months ago

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

2.问题描述(Bug description)

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

const schema = {
  type: 'object',
  displayType: 'column',
  properties: {
    key: {
      title: '测试校验',
      type: 'number',
      description: '有描述时',
      min: 1,
    },

    key2: {
      title: '测试校验(无描述)',
      type: 'number',
      min: 1,
    },
}
}

4.最小复现 demo(Reproduction demo)image

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 commented 7 months ago

这个好像是 antd 组件本身的问题, Form.Item 的 title 如果是字符串是正常的,如果是一个 JSX 它好像就会提示 key

目前没有太优雅的办法去解,你可以把 min 这种简易的写法或者是其他校验,按照校验配置完整写全 rules: [{ min: 1, message: ''}],这样就能正常显示了。