mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-30 11:16:12 +08:00
refactor(components): [autocomplete] improve typings (#7381)
* refactor(components): [autocomplete] improve typings * fix: rename
This commit is contained in:
parent
76297424cd
commit
c75b20fa64
@ -10,6 +10,18 @@ import { UPDATE_MODEL_EVENT } from '@element-plus/constants'
|
||||
import type { ExtractPropTypes } from 'vue'
|
||||
import type Autocomplete from './autocomplete.vue'
|
||||
import type { Placement } from '@element-plus/components/popper'
|
||||
import type { Awaitable } from '@element-plus/utils'
|
||||
|
||||
export type AutocompleteData = { value: string }[]
|
||||
export type AutocompleteFetchSuggestionsCallback = (
|
||||
data: AutocompleteData
|
||||
) => void
|
||||
export type AutocompleteFetchSuggestions =
|
||||
| ((
|
||||
queryString: string,
|
||||
cb: AutocompleteFetchSuggestionsCallback
|
||||
) => Awaitable<AutocompleteData> | void)
|
||||
| AutocompleteData
|
||||
|
||||
export const autocompleteProps = buildProps({
|
||||
valueKey: {
|
||||
@ -37,13 +49,7 @@ export const autocompleteProps = buildProps({
|
||||
default: 'bottom-start',
|
||||
},
|
||||
fetchSuggestions: {
|
||||
type: definePropType<
|
||||
| ((
|
||||
queryString: string,
|
||||
cb: (data: { value: string }[]) => void
|
||||
) => { value: string }[] | Promise<{ value: string }[]> | void)
|
||||
| { value: string }[]
|
||||
>([Function, Array]),
|
||||
type: definePropType<AutocompleteFetchSuggestions>([Function, Array]),
|
||||
default: NOOP,
|
||||
},
|
||||
popperClass: {
|
||||
|
Loading…
Reference in New Issue
Block a user