我正在使用 VeeValidate 创建自定义验证规则。官方文档对getMessage
andvalidate
方法使用箭头函数。如何在常规函数语法中实现这些函数?
VeeValidate.Validator.extend('verify_username', {
getMessage: field => 'Your username must be 3-24 characters long, \
contains only a-z, 0-9, a period or an underscore, and should begin \
with an alphabetic character.',
validate: value => /^[a-z][a-z0-9._]{2,23}$/.test(value)
});