alibaba / x-render

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

schema里增加了description后,必填文案,没取label,用的是name #1370

Closed JbSun closed 1 year ago

JbSun commented 1 year ago

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

2.问题描述(Bug description): 在schema中设置了description后,必填文案改变了。没取label,用的是name image

image

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

const schema = {
  type: 'object',
  properties: {
    floorGoods: {
      title: '货架兜底货品',
      type: 'number',
      required: true,
      description: '未命中货品池货品或打分模型匹配分数失败,推荐该货品'
    },
  },
}

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

MoYuM commented 1 year ago

是 antd 本身的问题。 因为目前 description 是加在 label 上的,这样的话, label 就变成 reactNode 了,于是就拿不到真实的 label。所以展示的就是 name。 antd 如果给 label 一个 reactNode 话,也是一样的效果。

MoYuM commented 1 year ago

建议自定义 rules 解决