vue element组件form表单效验?

html部分:

       
          

script部分:

const ruleForm = reactive({
  checkPass: '',
});
 
const rules = reactive>({
  checkPass: [{ validator: validatePass2, trigger: 'blur' }],
});
 
const validatePass2 = (rule: any, value: any, callback: any) => {
  if (value === '') {
    callback(new Error('请填写完整信息'));
  } else {
    callback();
  }
};

你可能感兴趣的:(vue.js,elementui,javascript)