Is there a way to implement data transfer from a parent component to a child component for error handling? Specifically, how can I add data to the errors bag from the parent component and then listen to a specific error in the child component to display something conditionally?
In the parent component, I have added the error to the errors bag like so:
export default {
mounted () {
this.$validator.errors.add('critical', 'Unable to connect', 'network')
}
}
Now in the child component, I want to display something conditionally based on the presence of an error in the error bag. This is what I have in my child component:
<a class="navbar-item" v-if="!errors.has('critical')">Hello World</a>
The issue I'm facing is that errors.has('critical')
returns false because VeeValidate creates a new instance for each component. How can I transfer the same errors bag from the parent component to the child component to effectively handle errors?