vue3 行内校验规则 rules validate校验

const form2 = ref()
function doSave() {
  loading.value = true;

  form2.value.validate((valid: any) => {
    if (valid) {
      httpPost({ method: "project.save", form: form.value }).then((res: any) => {
        emit("afterSave", "");
        if (res.status == 200) {
          alert(res.msg);
        }
        loading.value = false;
      }).catch(() => {
        loading.value = false;
      });
    } else {
      alert("请按提示完善表单项目")
      loading.value = false;
    }
  })
}








                
              

           保 存 
          提 交 中...
        

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