Element-ui multi-form simultaneous validation

 As shown in the above table [Column 2 and Column 3], the data cycled out of Column 1 uses the same verification rules  

method one:

        Get the form list data and loop through it (regularity/other) for verification. The verification in the above figure is based on actual needs as long as it is not empty

Method Two:

        Verify through the rules attribute of the element form Define the rules verification rules and cooperate with the method validate to verify

Single verification:

Multi-form validation:

Core: validate method ==> method to validate the entire form, the parameter is a callback function. The callback function will be called after the verification is completed, and two parameters are passed in: whether the verification is successful and the field that failed the verification. If no callback function is passed in, a promise will be returned and verified one by one by the Promise.all() method

 Reminder: The form is obtained through the v-for loop, and the bound ref=addData instance obtained through $refs is an array

 If the form verification is successful, continue to submit the form, otherwise a prompt will be given, and resubmit after correction

Guess you like

Origin blog.csdn.net/weixin_56421672/article/details/128836339
Recommended