IT

The way to extend vee-validate custom rules.

bepuri 2020. 11. 19. 12:29
728x90

If you want to extend vee-validate for mobile_number,

Implement validate function for validate check.

And message function will be used to represent for validation message.

 

 

extend("mobile", {

                    validate(value) { return /^01([0|1|6|7|8|9])([0-9]{3,4})([0-9]{3,4})$/.test(value) },

                    message(_, values) {return 'error'} 

                  }

      )

extend custom rules - logaretm.github.io/vee-validate/guide/localization.html#using-other-i18n-libraries

i18n for message - logaretm.github.io/vee-validate/guide/localization.html#using-other-i18n-libraries

728x90