0👍
In your child component add-user-form
you can use a custom event when user submits or edits a field.
I’m not sure how your child component looks like but you can do something like this:
child component
<label>
Username:
<input
v-on:input="$emit('usernameChanged', $event.target.value)"
>
</label>
parent component
<div v-if="operation.operationName=='addUser'">
<add-user-form
:module="module"
:operation="operation"
v-on:usernameChanged="validateUsername"
>
</add-user-form>
</div>
and add a method validateUsername
methods:{
validateUsername(value){
//validate username
}
}
- [Vuejs]-Vuex mutator method unable to change state properties
- [Vuejs]-How to disable submit button based on error validation for input field in vuejs?
Source:stackexchange.com