How to use the @vuelidate/validators/dist/raw.minLength function in @vuelidate/validators

To help you get started, we’ve selected a few @vuelidate/validators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuelidate / vuelidate / packages / docs / src / .vuepress / components / AsComposition.vue View on Github external
function usePassword ({ minimumLength }) {
  const password = ref('')
  const repeatPassword = ref('')

  const rules = {
    password: {
      required: withMessage('This field is required', required),
      minLength: withMessage(
        minLength(minimumLength),
        ({ $params }) => `Has to be at least ${$params.length} characters long`
      ),
      asyncValidator: withMessage(
        ({ $pending, $model }) => $pending ? 'Checking!' : `Error! ${$model} Isn’t "aaaa"`,
        asyncValidator
      ),
      $autoDirty: true
    },
    repeatPassword: {
      required,
      sameAs: withMessage(
        ({ $params }) => $t('errors.sameAs', $params.equalTo),
        sameAs(password)
      ),
      $autoDirty: true
    }

@vuelidate/validators

Validators for Vuelidate

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis

Similar packages