下拉选择器
用于方便用户从多个选项列表中进行选择。
单选
多选
在输入组中使用
选择一种水果
初始化选项
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
id | string | null | 组件根元素的 ID。 |
className | string array object | null | 类名。 |
style | object | null | 样式。 |
tagName | string | null | 组件根元素的标签名。 |
attrs | object | null | 附加到组件根元素上的属性。 |
clickType | 'toggle' 'open' | null | 点击类型,toggle 表示点击按钮时切换显示隐藏,open 表示点击按钮时只打开。 |
afterRender | function | null | 渲染完成后的回调函数。 |
beforeDestroy | () => void | null | 销毁前的回调函数。 |
name | string | null | 作为表单项的名称。 |
defaultValue | string string[] | null | 默认值。 |
onChange | function | null | 值变更回调函数。 |
disabled | boolean | null | 是否禁用。 |
multiple | boolean number | null | 是否允许选择多个值,如果指定为数字,则限制多选的数目,默认 false。 |
required | boolean | null | 是否必选(不允许空值,不可以被清除)。 |
placeholder | string | null | 选择框上的占位文本。 |
valueSplitter | string | null | 多个值的分隔字符串,默认为 ','。 |
items | object[] function | — | 列表项或列表项获取方法。 |
menu | MenuOptions | null | 附加的菜单选项。 |
hotkey | boolean | null | 是否启用快捷键。 |
search | boolean number | null | 是否启用搜索。 |
searchDelay | number | null | 搜索延迟时间,单位:毫秒。 |
searchHint | string | null | 搜索提示文本。 |
onDeselect | function | null | 当取消选择值时的回调函数。 |
onSelect | function | null | 当选择值时的回调函数。 |
onClear | () => void | null | 当清空值时的回调函数。 |
popContainer | string HTMLElement | null | 下拉面板容器元素。 |
popWidth | number 'auto' '100%' | — | 菜单宽度,如果设置为 '100%' 则与选择框宽度一致,默认 '100%' 。 |
popHeight | number 'auto' | — | 菜单高度,默认 'auto' 。 |
popMaxHeight | number | null | 菜单最大高度,默认 300 。 |
popMinHeight | number | null | 菜单最小高度,默认 32 。 |
popMaxWidth | number | null | 菜单最大宽度,当宽度设置为 'auto' 时生效。 |
popMinWidth | number | null | 菜单最小宽度,当宽度设置为 'auto' 时生效,默认 50。 |
popPlacement | string | null | 菜单方向,包括 auto 、top 、right 、bottom 、left 、bottom-start 、bottom-end 、left-start 、left-end 、right-start 、right-end 、top-start 、top-end ,默认 'auto' 。 |
popClass | string array object | null | 菜单类名。 |
popStyle | object | null | 菜单样式。 |
onPopShow | () => void | null | 菜单显示时的回调函数。 |
onPopShown | () => void | null | 菜单显示后的回调函数。 |
onPopHide | () => void | null | 菜单隐藏时的回调函数。 |
onPopHidden | () => void | null | 菜单隐藏后的回调函数。 |
列表项定义
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
value | string | — | 值。 |
keys | string | null | 关键字,用于搜索。 |
text | string | null | 文本。 |
disabled | boolean | null | 是否禁用。 |
className | string object string | null | 类名。 |
icon | string | null | 图标。 |
trailingIcon | string | null | 尾部图标。 |
hint | string | null | 提示文本。 |
attrs | object | null | HTML 属性。 |
style | object | null | 样式。 |