0👍
So if I got you right you want to setup two-way data binding for your custom component. So you can use the v-model
.
In your child component define the prop and emit value changes.
props: ['userObject'],
methods {
onUserSelected(items){
this.$emit('userObject', items);
}
}
In your parent component add the v-model
directive to your child components element:
<div v-if="userObject">
<child v-model="userObject"></child>
<p class="mb-0">First User: {{this.userObject}}</p>
</div>
- [Vuejs]-Trying to load data in option of dop downl list in vue js , and fetching data from axios api and in mounted function
- [Vuejs]-Fix for chained select vue js component
Source:stackexchange.com