What is the role of the parameter valid in this element check? What is the function of the parameter valid in this element check?

<el-form ref="formRoot"></el-form>
 this.$refs[formRoot].validate((valid) => {});

what is the role of the parameter valid in this element check? In what state is it true, and what does it mean when it is true?

May.27,2021

  1. valid is a formal argument to the anonymous function [(valid) = > {}];
  2. Anonymous function as the actual argument to the function validate;
  3. When the
  4. validate function executes, it assigns a value to the formal parameter valid. Specifically, when the validate function executes, it executes the anonymous function at some point and assigns a value to valid. If validate check is for true, to execute anonymous function, valid is assigned to true;. If validate check is for false, to execute anonymous function, valid is assigned to false.
  5. The sort method that comes with
  6. js. The argument can be a compare function, which can be used as an analogy. Var newArr = [1Jing 3, 13J 4] .sort ((num1, num2) = > num1-num2); num1, num2 here has the same effect as valid.

means whether the form component validates (that is, whether all the form-item components pass), and true indicates yes.


check passed as true, does not pass false

Menu