[Vuejs]-Vuex object forms: event delegation onto child component prop

0👍

From what I understand from your question, if your component is only an input field, you can use v-model to pass props.

v-model is essentially syntax sugar for updating data on user input events.

<input v-model="something">

is just syntactic sugar for:

<input v-bind:value="something" v-on:input="something = $event.target.value">

You can pass a prop : value in the child components, and on change of input field call following which will change the filter.name variable.

this.$emit('input', newVal)

This is how you will use your component:

<your-component v-model="filter.name"></your-component>

You can have a look at one implementation using this approach here.

Leave a comment