Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Validators #3

Closed
5 tasks
zhorton34 opened this issue May 13, 2020 · 0 comments
Closed
5 tasks

Refactor Validators #3

zhorton34 opened this issue May 13, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@zhorton34
Copy link
Owner

zhorton34 commented May 13, 2020

  • Include validator from 'vuejs-validators' as a dev-dependency

  • Automatically apply validator logic/macro methods when rules() method is used.

  • Replace validatable parameter
    Was: form(validatable, data).rules(...)
    Now: form(data).rules(...)

  • Replace form.getErrors() method
    Was: form.getErrors()
    Now: form.errors()

  • Replace form.getValidator() method
    Was: form.getValidator()
    Now: form.validator()

data: () => ({
  form: form({ 
        name: 'zak', 
        email: 'zak@cleancode.studio' 
    })
    .rules({
         name: 'required|min:5',
         email: 'required|email|min:8'
    })
    .messages({
        'name.required': ':attribute field is required',
        'name.min': ':attribute must have at least :min characters',
    })
});
@zhorton34 zhorton34 added the enhancement New feature or request label May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant