Level 1
You can use the mapFields helper like this:
<template>
<div>
<input v-model="inputs.name" name="name" v-validate="'required'">
<span v-show="name.touched && errors.first('name')">{{ errors.first('name') }}</span>
<input v-model="inputs.email" name="email" v-validate="'required'">
<span v-show="email.touched && errors.first('email')">{{ errors.first('email') }}</span>
</div>
</template>
<script>
import { mapFields } from 'vee-validate';
export default {
data() {
return {
inputs: {
name: '',
email: '',
},
};
},
computed: {
...mapFields(['name', 'email']),
},
mounted() {
console.log('fancy data', this.name, this.email);
console.log('bonus fancy data', this.fields, this.errors);
},
};
</script>
Then you will have this.name and this.email available, and you can use this.name.touched.