Object v-bind taking precedence over earlier attributes
Version
3.0.0-rc.10
Reproduction link
https://jsfiddle.net/skirtle/f78Lhcmt/
Steps to reproduce
The important section is this:
<my-child abc="specific" v-bind="{ abc: 'object' }" />
Note that abc
is set in two different ways.
What is expected?
In Vue 2 the value of abc
would have been 'specific'
.
What is actually happening?
abc
is 'object'
.
The order of the attributes now matters.
I also experimented with using :abc
for the first attribute but it doesn't seem to matter whether the prop is static or dynamic.
I know this topic has been discussed several times before but I haven't been able to find any official confirmation that this has been changed intentionally.
A look through the tests seems to suggest that this is being tested, so my guess is that it is an intentional change.
The most recent discussion I could find on this topic was 3 weeks ago. vue#11594. While that was a discussion about Vue 2 it does seem odd that the change in Vue 3 wasn't mentioned if it is indeed an intentional change.
Yes, this is an intentional change (v-bind
appearance order now affects merge result) and we should document it in the migration guide.
I have suggested a change that might be able to fix that: https://github.com/vuejs/rfcs/pull/215