Big shots in the element-UI framework custom verification function passed the first rule parameter exactly what to do, and how to solve, and how to use, thank you.

for example, the first parameter rule, passed in checkage does not seem to be used in the body of this function, so ask for advice.

  <el-form-item label="" prop="age">
    <el-input v-model.number="ruleForm2.age"></el-input>
  </el-form-item>   
    export default {
    data() {
      var checkAge = (rule, value, callback) => {
        if (!value) {
          return callback(new Error(""));
        }
        setTimeout(() => {
          if (!Number.isInteger(value)) {
            callback(new Error(""));
          } else {
            if (value < 18) {
              callback(new Error("18"));
            } else {
              callback();
            }
          }
        }, 1000);
      };
      return {
        ruleForm2: {
          age: ""
        },
        rules2: {
          age: [
            { validator: checkAge, trigger: "blur" }
          ]
        }
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert("submit!");
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
Mar.01,2021

this is the complete form. Rules, will print it out and have a look at it.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2c063-33e8f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2c063-33e8f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?