-
-
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 with something else than an object should warn you #6677
Comments
|
You should actually do |
@posva I'm not sure exactly where I picked it up. Probably reading code from other open source projects and replicating the behavior. I could certainly be ignorance on my part, not putting 2 and 2 together wrt I'm pretty positive I've never read (and didn't think to reference) the |
Ok, thanks. I changed the title |
I can take this one and add the warning |
You can bind strings with type coercion. <slot v-bind="{toString: () => variable}" /> |
Version
2.4.4
Reproduction link
https://jsfiddle.net/57508hba/4/
Steps to reproduce
v-bind
What is expected?
The string bound to the slot should be passed into the template passed for the slot, as a string.
What is actually happening?
The string is being exploded into an object where the properties are the string indexes for each character in the string.
I'm not sure if this is intended behavior or not. The default value for the defined slot outputs the string as expected, but as soon as it's passed to the consumer defined template, the string is altered to an object.
The temporary work-around for this is to simply pass an actual object to v-bind on the slot, and expect an object as the scoped value in your defined template.
It seems that if this is intended behavior, there should be at least a Vue warning about the value being mangled and that v-bind expects an object and not string.
The text was updated successfully, but these errors were encountered: