Saeid 4 years ago
commit 18f46eaba7

@ -5,4 +5,16 @@ import fa from "@Global/utils/vee-validate/locale/fa";
import "@Global/utils/vee-validate/newRules";
Vue.use(VeeValidate);
const phoneRule = {
getMessage(field, args) {
return `The ${field} must be either a valid phone number`;
},
validate(value, args) {
const PHONE_REG = /^0\d{2,3}\d{8}$/;
return PHONE_REG.test(value);
}
};
VeeValidate.Validator.extend('phone', phoneRule);
Validator.localize("fa", fa);

Loading…
Cancel
Save