[Vuejs]-Can not listen to parent from emitting child

0👍

Your problem is that you are using this.$parent.$emit("flu") instead of this.$emit("flu")

this.$emit will dispatch an event from the child to its parent component.

this.$parent is a reference of the parent component. So you are emitting an event from the parent of the child to its own parent.

The code in your sandbox is different to what you shared in your original post, so this is why it’s hard to give you the answer right away.

Here is a working example (forked from your sandbox):

https://codesandbox.io/s/festive-violet-fu2p9

Leave a comment