Ant Design 设置必填属性的一个坑!Objects are not valid as a React child (found: object with keys {requiredMsg}). If you meant to render a collection of children, use an array instead.

1、刚开始,我是用第一种方式。通过一个变量,来设置必填属性的提示值

 显示是没有问题的。

但是点击ModalForm 确认按钮时,报错

Objects are not valid as a React child (found: object with keys {requiredMsg}). If you meant to render a collection of children, use an array instead.

 

解决:

 最后将message 换回固定的写法,就没有问题了!

 

posted @ 2024-03-28 11:40  信铁寒胜  阅读(57)  评论(0编辑  收藏  举报