Pit encountered in Ant Design Vue (2) `Form.Item` cannot generate `validateStatus` and `help` automatically...

One, the scene

When using Ant Design, I entered the page and opened the console and found a red warning:

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

Two, cause

After searching, it is found that multiple input boxes are generated using v-for loop traversal in the same form-item, and each of them is added with v-decorator as an array, but in fact, only one v- is allowed in each from-item The decorator is bound.

Three, the solution

Wrap a layer of form-item outside the element (such as input) that needs to be added v-decorator to be generated in the v-for, that is, looping through the n elements will generate n form-items, which satisfies one form-item There is only one v-decorator request, no more errors.

Guess you like

Origin blog.csdn.net/weixin_49299412/article/details/112505969