0

I'm using vue-select. When I want to display the selected element, it shows me the value and not the text (see the screen). I saw on several reports (and on the documentation) that I could use reduce. I also saw that I could add a ":key" props on the component but that doesn't work either.

Here I choose the item :

enter image description here

Here the selected item, it displays the value and not the text : (Here the problem)

enter image description here

My component file (input-custom.vue) :

enter image description here

My component in page: enter image description here

Data in page:

enter image description here

2 Answers 2

0

I found the solution.

This is my "handleInput" method.

I emit "e.value" but I want to emit the Object, so replace "e.value" => "e"

Sign up to request clarification or add additional context in comments.

Comments

0
here there are three props used:

 - :options="optionsVariable" - optionsVariable contains array of objects/Array
 - label="optionName"- label prop is the Array Item which You need to display ( here from each array of objects, you display 'optionName'.
 - :reduce="option => option.optionValue" - reduce will store optionValue from each array of objects to the v-model variable 'vModelVariable'

<v-select
 label="optionName" 
 :options="optionsVariable" 
 v-model="vModelVariable" 
 :reduce="option => option.optionValue"
 :placeholder="Enter Placeholder"
>
</v-select>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.