[Vuejs]-How to provide validation on a login from components in coreui

1๐Ÿ‘

I think you are looking for Vuelidate. To explain in brief, you can import Vuelidate in your project and the built-in validators.

import { email, required } from 'vuelidate/lib/validators'

export default {
    validations: {
          email: {
              email,
              required
          }
    }
}

Once you import Vuelidate in your project, it makes a validations object available with which you can specify the validation mappings. These mappings are available in the template via $v and can be updated on events as

<input type="text" placeholder="Email" v-model="data.email" @blur="$v.email.$touch()">

This is just the beginning and you should learn more from online sources.

๐Ÿ‘คSaksham

Leave a comment