undefinedfix
Sign in

How to verify multiple different types of input boxes by adding or deleting form items dynamically in element UI

zvej edited in Sat, 03 Dec 2022

Similar to this kind of addition, two input boxes are added at a time. But I don't know how to write it. I don't know if a big man has ever met such a scene. Or there is a better solution, please provide.

2 Replies
abalfazl9776
commented on Sat, 03 Dec 2022

Refer to this: https://blog.csdn.net/qq_ 4020...

cashsavings
commented on Sat, 03 Dec 2022

You can put validation rules in El form item. Similar to: elementui form dynamically increases or decreases form items

<el-form-item 
    v-for="(domain, index) in dynamicValidateForm.domains"
    :label="'域名' + index" 
    :key="domain.key" 
    :prop="'domains.' + index + '.value'"
    :rules="{ required: true, message: '域名不能为空', trigger: 'blur' }"
>
    ....
</el-form-item>

You can also click DEMO on the lower right corner of the online operation to debug in CodePen.