Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why v-bind="$attrs" cannot replace the declared same name props in front of itself? #11888

Closed
wangziling opened this issue Jan 25, 2021 · 2 comments

Comments

@wangziling
Copy link

Version

2.6.11

Reproduction link

https://codesandbox.io/s/cocky-brahmagupta-ejn2z

Steps to reproduce

See the codesandbox result~

What is expected?

In my opinion and normal thoughts, if v-bind="$attrs" or v-bind="$props" is behind a declared and in same name property, it should replace the property value ahead.

<a href="https://qq.com" v-bind="$attrs">Test</a>

if $attrs contain the property named 'href', In the normal thoughts, it should replace the data ahead.

What is actually happening?

Cannot replace.


Am I wrong?
Or Hmmm... v-bind="$attrs" take the lower priority of the normal v-bind:href="__"?

@posva
Copy link
Member

posva commented Jan 25, 2021

In Vue 3, the order of attributes matter but in Vue 2 they don't and a single attribute is more specific that a v-bind. See #7811

@posva posva closed this as completed Jan 25, 2021
@wangziling
Copy link
Author

OK. Thank you. @posva.

I left a version3 demo.
https://codesandbox.io/s/brave-rubin-gofp0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants