How to use vuelidate with vuetify 2 for nested data? Getting invalid field How to use vuelidate with vuetify 2 for nested data? Getting invalid field vue.js vue.js

How to use vuelidate with vuetify 2 for nested data? Getting invalid field


You have to use the same data shape between your data and your validations. See Data Nesting.

So your validations must be:

validations: {  user: {    no_nome: {      required    }  }}

and

computed: {  nameErrors () {    const errors = []    if (!this.$v.user.no_nome.$dirty)      return errors    !this.$v.user.no_nome.required && errors.push('Name is required.')    return errors  }}

and

<v-text-field  v-model="user.no_nome"  :error-messages="nameErrors"  @input="$v.user.no_nome.$touch()"  @blur="$v.user.no_nome.$touch()"/>

Example