vue-bootstrap-select icon indicating copy to clipboard operation
vue-bootstrap-select copied to clipboard

Resolve `valueProp` when it is set

Open Skaradams opened this issue 5 years ago • 4 comments

Hey thanks for this Select. I had troubles finding a good select with search, before finding yours. Small issue though :

If i pass items with this format : [{id: 1, value: "item1"}, {id: 2, value: "item2"}] and i add the props : text-prop="value" and value-prop="id"

I should get the id from the v-model, when i select an item from the list. Currently, it returns the whole object

Skaradams avatar May 28 '19 14:05 Skaradams

Thank you, I'm glad you find it useful. Actually that's the expected behavior 😬 , you could do object.id to access it.

Sandalf avatar May 29 '19 22:05 Sandalf

I don't understand the use of value-prop then :/ (since text-prop works as i expected)

Skaradams avatar May 31 '19 08:05 Skaradams

value-prop is used to find the selected option in the drop down list, but I do understand your point. Though I think is more common to return the entire object than a single prop. One option could be to add a formatter prop, that you can pass as a function, so that I returns the selected object in the way you want it.

Sandalf avatar Jun 02 '19 15:06 Sandalf

If it's not against your component's design, that would be a great solution

Skaradams avatar Jun 06 '19 16:06 Skaradams