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:
+33
-1
@@ -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);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user