zwl1619
zwl1619

Reputation: 4232

vue-strap `select` component

I am using vue-strap's select component, Documentation:http://yuche.github.io/vue-strap/#select , my demo is the first example in documentation.

my demo: https://jsfiddle.net/kanjiushi/ne92wfxp/6/

I have 2 questions about my demo:

1、there is a placeholder Nothing Selected in documentation's demo.How to add it in my demo?

my demo: enter image description here

demo in the documentation: enter image description here

2、How to get the value of the selected item and save it in a variable?I will use it to send a ajax request.

Some help please,thanks in advance.

Upvotes: 1

Views: 1401

Answers (1)

Yerko Palma
Yerko Palma

Reputation: 12329

you missed the :value.sync directive. that solves both of your problems. Check this fiddle with the result. Here is the code also

<v-select :value.sync="val">
   <v-option value="1">Apple</v-option>
   <v-option value="2">Banana</v-option>
   <v-option value="3">Cherry</v-option>
   <v-option value="4">Orange</v-option>
   <v-option value="5">Grape</v-option>
</v-select>

Notice that I had to add a val data to your component.

Upvotes: 1

Related Questions