[Vuejs]-Vue emit once on multiple

0👍

You can do everything with Vuex and that would be a cleaner solution, since in your storage you will be more aware of your data flow.

In case 1 you can commit a mutation and then in all places needed watch for changes or better, just use computed values. EventBus is not bad pattern, but I think it’s more suitable for big distributed projects, where you really want to propagate events, not just pass data updates.

For case 2 you don’t need anything but Vue. Just pass parameters and watch them in children components.

Leave a comment