mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
bump upgrade guide (#833)
This commit is contained in:
@@ -43,8 +43,8 @@ global variable. You'll need to load Vue.js, vue-select JS & vue-select CSS.
|
|||||||
<link rel="stylesheet" href="https://unpkg.com/vue-select@latest/dist/vue-select.css">
|
<link rel="stylesheet" href="https://unpkg.com/vue-select@latest/dist/vue-select.css">
|
||||||
|
|
||||||
<!-- or point to a specific vue-select release -->
|
<!-- or point to a specific vue-select release -->
|
||||||
<script src="https://unpkg.com/vue-select@2.6.0"></script>
|
<script src="https://unpkg.com/vue-select@3.0.0"></script>
|
||||||
<link rel="stylesheet" href="https://unpkg.com/vue-select@2.6.0/dist/vue-select.css">
|
<link rel="stylesheet" href="https://unpkg.com/vue-select@3.0.0/dist/vue-select.css">
|
||||||
```
|
```
|
||||||
Then register the component in your javascript:
|
Then register the component in your javascript:
|
||||||
|
|
||||||
@@ -56,5 +56,5 @@ Vue.component('v-select', VueSelect.VueSelect);
|
|||||||
|
|
||||||
## Vue Compatibility
|
## Vue Compatibility
|
||||||
|
|
||||||
If you're on Vue `1.x`, use vue-select `1.x`. The `1.x` branch has not received updates
|
- If you're on Vue `1.x`, use vue-select `1.x`.
|
||||||
since the 2.0 release.
|
- The `1.x` branch has not received updates since the 2.0 release.
|
||||||
|
|||||||
+24
-2
@@ -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`
|
- `onChange`
|
||||||
- `onInput`
|
- `onInput`
|
||||||
|
|||||||
Reference in New Issue
Block a user