2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-16 09:10:33 +03:00

bump upgrade guide (#833)

This commit is contained in:
Jeff Sagal
2019-04-14 19:29:28 -07:00
committed by GitHub
parent 12665a594b
commit 5e0ad1982f
2 changed files with 28 additions and 6 deletions
+24 -2
View File
@@ -1,6 +1,28 @@
## Removed Function Callbacks
## `index` prop replaced with `reduce`
Three function callbacks have been removed in favor of using events.
- v2.x provided the `index` `{String}` prop to return a single key from a selected object
- v3.x removes the `index` prop, replacing it with the `reduce` `{Function}` prop.
Using a function instead of a string provides a whole lot more flexibility, allowing for things like
deeply nested values, and really cleaned up the code internally.
```js
const options = [{country: 'Canada', code: 'CA'},];
```
```html
<!-- v2: using index --->
<v-select :options="options" label="country" index="code" />
<!-- v3: using reduce --->
<v-select :options="options" label="country" :reduce="country => country.code" />
```
View the full [documentation for `reduce`](values.md#returning-a-single-key-with-reduce).
## Events instead of Callbacks
Three function callbacks have been removed in favor of using events.
- `onChange`
- `onInput`