How to use @vuelidate/core - 2 common examples

To help you get started, we’ve selected a few @vuelidate/core 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
({ $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
    }
  }

  const $v = useVuelidate(
    rules, { password, repeatPassword }, 'usePassword'
  )

  return {
    $v,
    password,
    repeatPassword,
    rules
  }
}
github vuelidate / vuelidate / packages / docs / src / .vuepress / components / AsComposition.vue View on Github external
const keyLength = ref(3)
    const user = reactive({
      firstName: '',
      lastName: ''
    })
    const userRules = {
      hasKeys: withMessage(
        ({ $params }) => `Should have exactly ${$params.keys} keys.`,
        hasKeysWithParams(keyLength)
      ),
      firstName: { required },
      lastName: { required }
    }

    const $vUser = useVuelidate({ user: userRules }, { user }, 'useUser')

    return { password, repeatPassword, $v, minimumLength, $vUser, keyLength }
  }
}

@vuelidate/core

Simple, lightweight model-based validation for Vue.js

MIT
Latest version published 2 months ago

Package Health Score

93 / 100
Full package analysis

Popular @vuelidate/core functions

Similar packages