Validate child input components on submit with Vee-Validate

前端 未结 6 503
-上瘾入骨i
-上瘾入骨i 2021-01-17 17:36

I\'m currently trying to create a Registration form with multiple \"Input Field\" components which all require validating once Submit has been pressed. They all currently va

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-17 18:10

    I had to use a promise to check validation before submitting form.

    Code below from @ChalkyJoe original question

    module.exports = {
      methods: {
        submitForm() {
          //this.$validator.validateAll();
          this.$validator.validateAll().then((result)=>{
              if(!result){
                error();
              }
              submit();
          })
        }
      },
      data() {
        return {
          email: '',
          confirm_email: ''
        };
      },
    

提交回复
热议问题