-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
v-bind=$attrs overrides the input type attribute in 2.5.14 and above #7811
Labels
Comments
Same issue. The |
privatenumber
pushed a commit
to privatenumber/vue
that referenced
this issue
Mar 13, 2018
yyx990803
pushed a commit
that referenced
this issue
Mar 13, 2018
This was referenced Mar 14, 2018
f2009
pushed a commit
to f2009/vue
that referenced
this issue
Jan 25, 2019
aJean
pushed a commit
to aJean/vue
that referenced
this issue
Aug 19, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
2.5.14
Reproduction link
https://jsfiddle.net/linnea/onw3Lfm4/2/
Steps to reproduce
Create a custom component with an input wrapped in a div and:
v-bind="$attrs"
type="checkbox"
What is expected?
The inner input still receives type="checkbox"
What is actually happening?
No type attribute is inherited
We have a custom checkbox component that provides label styling etc, and used to be able to declare the input type as well as inherit attributes from the component. Other attributes that are set on the inner input are passed correctly (ie disabled, :true-value, etc), but not the type attribute, unless you bind it. This was working prior to v2.5.14.
A temporary fix we've implemented is changing
type="checkbox"
to:type="'checkbox'"
, or setting v-bind="$attrs" to a computed property that returns an object with Object.assign({ type: 'checkbox'}, this.$attrs);Removing the v-model from the input also fixes it, but we use it to handle multiple checkboxes, bound to the same array
Here's the same fiddle above, working in 2.5.13
https://jsfiddle.net/linnea/onw3Lfm4/4/
The text was updated successfully, but these errors were encountered: