-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Description
Version
2.5.1+
Reproduction link
https://jsfiddle.net/bvyo2yra/
Steps to reproduce
See the minimal reproduction.
What is expected?
Previous to 2.5.1, v-on="$listeners"
could be used in combination with more specific event handlers to create components that could transparently pass events to an element inside them. This worked because the more specific listeners (e.g. @input="$emit('input', $event.target.value)
) were called after the more generic listeners with v-on="$listeners
.
What is actually happening?
In 2.5.1, these higher priority listeners are now triggered first, so that if the listener sets a value, it will set the correct value, then the incorrect value, breaking v-model
.
The breaking change was made to solve another issue, so it's probably not ideal to just revert the change. And actually, even the previous behavior was slightly undesirable, as it emitted the same event twice.
To fix both issues, I would actually expect the more specific event binding (e.g. @input
) to replace the listener of the same name from v-on
with the object syntax. The more specific listener would then take responsibility for emitting an event at the correct time. That allows the user full, explicit control over the order in which local handlers and handlers from the parent are called.
How does that sound to others?