[Vuejs]-VeeValidate – custom validation functions in ES5

2πŸ‘

βœ…

If you don’t want to use arrow function, you can just pass a normal function in its place as:

VeeValidate.Validator.extend('verify_username', {
  getMessage: function (field) {
    return "username must be..."
  },
  validate: function (value) {
    return "[...]"
  }
}); 

These functions are identical:

(foo) => 'bar'; 

is the same as:

function (foo) {
  return 'bar'
}
πŸ‘€samayo

Leave a comment