Bootstrap

el-form-item 校验--指定单个表单的校验+指定单个校验的清除

在这里插入图片描述

去除form表单默认校验的这两个值

 this.$nextTick( ()=> {
    this.$refs['form'].clearValidate(['firstParty']);
     this.$refs['form'].clearValidate(['secondParty']);
   })

resetFields() 和 .clearValidate() 区别

this.$refs.form.resetFields(); //移除校验结果并重置字段值

this.$refs.form.clearValidate(); //移除校验结果

指定校验

// this.$refs.form表单的ref.validateField([单个item的prop名])
this.$refs.form.validateField(['num1'], (Error) => {
    if (!Error) {
      // 验证通过
      console.log('通过了')
    } else {
      console.log('验证不通过')            
    }
})

;