The difference between this. $ Parent. $ Emit and this. $ Emit

When we need a custom component to fire an event in VueTable2 , we must use:

this.$parent.$emit('myCustomEvent')

// instead of
this.$emit('myCustomEvent')

      

This thread tells us about this aspect.

I used to trigger this.$emit()

when I had to fire an event. I was wondering what are the main differences between them?

+3


source to share


1 answer


this.$emit

dispatches an event to its parent component.

this.$parent

gives a reference to the parent component.



As you might have guessed, this.$parent.$emit

will force the parent to dispatch the event to the parent.

+9


source







All Articles