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

Object values on option elements are stringified when using slots #9057

Closed
peterfox opened this issue Nov 12, 2018 · 2 comments
Closed

Object values on option elements are stringified when using slots #9057

peterfox opened this issue Nov 12, 2018 · 2 comments

Comments

@peterfox
Copy link

Version

2.5.17

Reproduction link

https://jsfiddle.net/SlyFoxy12/eywraw8t/456496/

Steps to reproduce

Create a component with a slot which has select options passed to it that use objects. The options need objects applied for values, although I believe it will stringify the value no matter what is passed through.

What is expected?

Making a custom select element using a component with a select and a slot for the options should work with objects instead of providing the string value "[object Object]" on change.

What is actually happening?

Options passed to the component via a slot appear to get converted to a string when passed through a slot.


Example JS Fiddle shows behaviour with a normal select control and a custom select control as described when the options are passed through to the select as a slot.

As you will see the select box behaves fine but the custom component always produces a "[object Object]" value.

@posva
Copy link
Member

posva commented Nov 12, 2018

It's because you're emitting the value from the event instead of the value hold by v-model

this.$emit('change', this.selectedThing)

@posva posva closed this as completed Nov 12, 2018
@peterfox
Copy link
Author

@posva confirmed working now, thank you

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