Subscribe on changes!

Defining emits removes them from attrs

avatar
Nov 4th 2021

Version

3.2.21

Reproduction link

stackblitz.com

SFC Playground (the iframe has limited height, so stackblitz.com is recommended)

Steps to reproduce

Clicking on buttons will send the event if listener exists on attrs.
Uncomment emits to see the behaviour changing.

What is expected?

Either defining emits shouldn't remove onListener (where listener is the name of an event) from attrs, or there should be a way to check for listeners.

What is actually happening?

Defining event name removes the property from attrs, there's no way to check for declared listeners.

avatar
Nov 4th 2021

For now, if you want to check for declared listeners, define them as onX props instead. Props starting with on followed by an uppercase letter are considered event listeners.