From d1de8da59f11903927eaf58cf7590e9c50f8989b Mon Sep 17 00:00:00 2001 From: Simone Todaro Date: Wed, 17 Jan 2018 21:03:12 +0000 Subject: [PATCH] Update documentation --- docs/gitbook/Basics/Options.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/gitbook/Basics/Options.md b/docs/gitbook/Basics/Options.md index 0eeb671..6269732 100644 --- a/docs/gitbook/Basics/Options.md +++ b/docs/gitbook/Basics/Options.md @@ -33,6 +33,27 @@ If you wanted to display `Canada` in the dropdown, you'd use the `countryName` k [](codepen://sagalbot/aEjLPB?height=500) + +### Option index {#values} + +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. + +For example, consider an object with `value` and `label` properties: + +```json +{ + value: "CA", + label: "Canada" +} +``` + +If you wanted to return `CA` in the dropdown when `Canada` is selected, you'd use the `index` key: + +```html + +``` + + ### Null / Empty Options {#emptyOptions} `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 `[]`.