feat(components): [autocomplete] expose blur event (#8364)

* feat(components): [autocomplete] expose blur event

* docs(components): [autocomplete] update
This commit is contained in:
qiang 2022-06-27 12:39:25 +08:00 committed by GitHub
parent 9c154e9228
commit 598f3ab5cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 12 deletions

View File

@ -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
@ -85,3 +80,4 @@ autocomplete/remote-search
| Method | Description | Parameters |
| ------ | ----------------------- | ---------- |
| focus | focus the input element | — |
| blur | blur the input element | — |

View File

@ -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])
@ -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 */