I have a child component that needs to say something to the parent of a parent (the grandparent?). Right now, this only works if the parent acts as a conduit:
from the child component, I call this.$emit('hello', 'hi grandma!')
. Then the parent does the same from the sayHello
method, and then the grandparent finally receives the data:
<grandparent>
<parent @hello="sayHello">
<child></child>
</parent>
</grandparent>
is there a better way to communicate up the chain? It looks like the docs recommend an event hub; this strikes me as a more complicated solution?
Is there any reason I shouldn't use this.$parent.$emit('hello', 'hi grandma!')
?