[Vuejs]-Why don't works emits?

1👍

You’re attaching the listeners to the update:plusEmit and update:minusEmit on the ButtonsList component. The problem is that component doesn’t emit those events. Event listeners have to be placed on the components that emit those events, in your case, they won’t bubble up to the parent.

You could either:

  1. Define the same events on the ButtonList component and emit them when the child emits their event like this:
<ButtonPlus @update:plusEmit="emit('update:plusEmits')" />
<ButtonMinus @update:minusEmit="emit('update:minusEmits')"/>   
  1. Or do away with the subcomponents for the buttons and define them in the ButtonsList

Leave a comment