Ant Design Vue 中遇到的坑(二) `Form.Item` cannot generate `validateStatus` and `help` automatically...

一、发生场景

在使用Ant Design 时,进入页面打开控制台发现有红色的警告:

‘Form.Item’ cannot generate ‘validateStatus’ and ‘help’ automatically,
while there are more than one ‘getFieldDecorator’ in it.

二、原因

经过查找发现在同一个form-item中使用v-for循环遍历生成了多个input框,并且每个都加上了v-decorator作为数组,但实际每一个from-item中只允许有一个v-decorator进行绑定。

三、解决办法

在v-for内要生成的要加v-decorator的元素(如input)外再包裹一层form-item,即对n个元素进行循环遍历将生成n个form-item,满足了一个form-item仅有一个v-decorator的要求,不再报错。

猜你喜欢

转载自blog.csdn.net/weixin_49299412/article/details/112505969
今日推荐