2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-17 02:29:37 +03:00

feat: option selection events (#1324)

- `option:selecting` before state is set
- `option:selected` after state is set
- `option:deselecting` before state is set
- `option:deselected` after state is set

Co-authored-by: tiagoroldao <troldao@assurehedge.com>
Co-authored-by: Jeff <sagalbot@gmail.com>
This commit is contained in:
Tiago Roldão
2020-12-18 21:18:34 +01:00
committed by GitHub
parent f947e253c5
commit 6e1c0dbcbd
3 changed files with 116 additions and 1 deletions
+33 -1
View File
@@ -9,13 +9,45 @@ Triggered when the selected value changes. Used internally for `v-model`.
this.$emit("input", val);
```
## `option:selecting` <Badge text="v3.11.0+" />
Triggered after an option has been selected, <strong>before</strong> updating internal state.
```js
this.$emit("option:selecting", selectedOption);
```
## `option:selected` <Badge text="v3.11.0+" />
Triggered when an option has been selected, <strong>after</strong> updating internal state.
```js
this.$emit("option:selected", selectedOption);
```
## `option:deselecting` <Badge text="v3.11.0+" />
Triggered when an option has been deselected, <strong>before</strong> updating internal state.
```js
this.$emit("option:deselecting", selectedOption);
```
## `option:deselected` <Badge text="v3.11.0+" />
Triggered when an option has been deselected, <strong>after</strong> updating internal state.
```js
this.$emit("option:deselected", deselectedOption);
```
## `option:created`
Triggered when `taggable` is `true` and a new option has been created.
```js
/**
* @param newOption {Object} - created option
* @param newOption {Object} - created option
*/
this.$emit("option:created", newOption);
```