A
A
Alexander2018-02-21 12:17:22
JavaScript
Alexander, 2018-02-21 12:17:22

What is the point of eventBus if $root can be used?

As I understand it, eventBus can only make sense if multiple vue instances are used. Or something else?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
markmariner, 2018-02-22
@markmariner

The bottom line is that it is correct in the View philosophy to use properties and events for interaction between components. Such code is easy to debug, and the application is easy to change /
If you use the event bus, then you can change your components and the connections between them as you like, leaving a subscription to the necessary events. If you bind to some variables, then from that moment the application structure changes badly.
In general, you never need to use $root, nor should you use $parent or $children. Think about the architecture of the application without them and discover for yourself how logical the design of your application becomes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question