Skip to content

AutoComplete 自动完成

规则

基础示例

Props 配置示例

静态选项

远程搜索(模拟接口)

选中后清空

禁用

尺寸对比(小 / 中 / 大)

Events 事件示例

监听输入和选择

选择后联动更新

完整配置项:naive-ui_AutoComplete

value :String

Props

名称类型默认值说明版本
blur-after-selectbooleanfalse选中后是否 blur
clear-after-selectbooleanfalse选中后是否清空
clearablebooleanfalse自动填充是否支持可清除
disabledbooleanfalse自动填充是否禁用
get-show(value: string) => booleanundefined根据输入值在聚焦的状态中决定是否显示菜单
input-propsHTMLInputAttributesundefined自动填充中 input 元素的属性
loadingbooleanfalse是否展示加载状态
optionsArray<string | AutoCompleteOption | AutoCompleteGroupOption>[]自动填充的自定义选项
placeholderstring'请输入'自动填充的提示信息
placement'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-start' | 'bottom' | 'bottom-end' | 'left-start' | 'left' | 'left-end' | 'bottom-start'自动填充的弹出位置2.25.0
render-label(option: SelectOption | SelectGroupOption, selected: boolean) => VNodeChildundefined选项标签渲染函数2.24.0
render-option(info: { node: VNode, option: SelectOption | SelectGroupOption, selected: boolean }) => VNodeChildundefined选项的渲染函数2.24.0
size'small' | 'medium' | 'large''medium'自动填充的尺寸大小
on-blur(event: FocusEvent) => voidundefinedblur 时触发的回调函数
on-focus(event: FocusEvent) => voidundefinedfocus 时触发的回调函数
on-select(value: string) => voidundefinedselect 选中时触发的回调函数
on-update:value(value: string | null) => voidundefined可控数据更新时触发的回调函数

FormCreate 是一个开源项目,基于 MIT 许可证发布,欢迎个人和企业用户免费使用