-2👍
You can use $emit method for this purpose.
v-on directive captures the child components events that is emitted by $emit
Child component triggers clicked event:
export default {
methods: {
onClickButton (event) {
this.$emit('clicked', 'someValue')
}
}
}
Parent component receive clicked event:
<div>
<child @clicked="onClickChild"></child>
</div>
export default {
methods: {
onClickChild (value) {
console.log(value) // someValue
}
}
}
- [Vuejs]-Binding local image using v-for – vuejs
- [Vuejs]-Show tooltip in Autocomplete dropdown items using Vuetify
Source:stackexchange.com