Skip to content

Commit

Permalink
feat(components): [autocomplete] expose blur event (#8364)
Browse files Browse the repository at this point in the history
* feat(components): [autocomplete] expose blur event

* docs(components): [autocomplete] update
  • Loading branch information
tolking committed Jun 27, 2022
1 parent 9c154e9 commit 598f3ab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
20 changes: 8 additions & 12 deletions docs/en-US/component/autocomplete.md
Expand Up @@ -60,18 +60,13 @@ autocomplete/remote-search

## Autocomplete Slots

| Name | Description |
| ------- | ------------------------------- |
| prefix | content as Input prefix |
| suffix | content as Input suffix |
| prepend | content to prepend before Input |
| append | content to append after Input |

## Autocomplete Scoped Slot

| Name | Description |
| ---- | --------------------------------------------------------------------- |
|| Custom content for input suggestions. The scope parameter is { item } |
| Name | Description |
| ------- | --------------------------------------------------------------------- |
|| Custom content for input suggestions. The scope parameter is { item } |
| prefix | content as Input prefix |
| suffix | content as Input suffix |
| prepend | content to prepend before Input |
| append | content to append after Input |

## Autocomplete Events

Expand All @@ -85,3 +80,4 @@ autocomplete/remote-search
| Method | Description | Parameters |
| ------ | ----------------------- | ---------- |
| focus | focus the input element ||
| blur | blur the input element ||
6 changes: 6 additions & 0 deletions packages/components/autocomplete/src/autocomplete.vue
Expand Up @@ -292,6 +292,10 @@ const focus = () => {
inputRef.value?.focus()
}
const blur = () => {
inputRef.value?.blur()
}
const handleSelect = async (item: any) => {
emit(INPUT_EVENT, item[props.valueKey])
emit(UPDATE_MODEL_EVENT, item[props.valueKey])
Expand Down Expand Up @@ -369,6 +373,8 @@ defineExpose({
handleKeyEnter,
/** @description focus the input element */
focus,
/** @description blur the input element */
blur,
/** @description close suggestion */
close,
/** @description highlight an item in a suggestion */
Expand Down

0 comments on commit 598f3ab

Please sign in to comment.