Right now I'm using an event bus to call methods of certain Vue components from other non-related Vue components.
I have a functioning Vuex store, so I'm trying to get rid of the event bus and move this functionality to Vuex store.
Questions
Should I move event bus functionality to Vuex store or should I use both?
What's the best way to implement event bus functionality in a Vuex store?
Could you please give an actual example of how to call a method inside another non-related component using Vuex:
First.vue
methods: {
test1 () {
console.log('test1 was called')
}
}
Second.vue
methods: {
callMethodInsideFirstComponent () {
...
}
}