Skip to content

Commit d1de8da

Browse files
author
Simone Todaro
committed
Update documentation
1 parent 07eb7b1 commit d1de8da

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/gitbook/Basics/Options.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ If you wanted to display `Canada` in the dropdown, you'd use the `countryName` k
3333

3434
[](codepen://sagalbot/aEjLPB?height=500)
3535

36+
37+
### Option index {#values}
38+
39+
When the `options` array contains objects, `vue-select` returns the whole object as dropdown value upon selection. You can specify your own `index` prop to return only the value contained in the specific property.
40+
41+
For example, consider an object with `value` and `label` properties:
42+
43+
```json
44+
{
45+
value: "CA",
46+
label: "Canada"
47+
}
48+
```
49+
50+
If you wanted to return `CA` in the dropdown when `Canada` is selected, you'd use the `index` key:
51+
52+
```html
53+
<v-select index="value" :options="countries"></v-select>
54+
```
55+
56+
3657
### Null / Empty Options {#emptyOptions}
3758

3859
`vue-select` requires the `option` property to be an `array`. If you are using Vue in development mode, you will get warnings attempting to pass anything other than an `array` to the `options` prop. If you need a `null`/`empty` value, use an empty array `[]`.

0 commit comments

Comments
 (0)