0👍
What you are looking for is called event bus
, you can create it to fire parent
events from children events.
It should go props down, events up (down being parent to child).
In your case, something like:
const EventBus = new Vue();
on your child component:
@click="$bus.$emit('deleteMultiple')"
and in the parent:
created () {
this.$bus.$on('deleteMultiple', ($event) => {
this.deleteMultiple();
})
}
There are lot of tutorials over internet on differents types of bus and plugins like this: https://medium.com/@andrejsabrickis/https-medium-com-andrejsabrickis-create-simple-eventbus-to-communicate-between-vue-js-components-cdc11cd59860 or http://vuetips.com/global-event-bus
Hope it helps!
- [Vuejs]-Having vuefire+firebase binding collections error
- [Vuejs]-Isn't draws vertical line on hover when I move cursor fast
Source:stackexchange.com