Skip to content

Select 选择器

基础用法

有禁用选项

option 中,设定 disabled 值为 true ,即可禁用该选项

有禁用选项

dd-select 设置 disabled 属性,则整个选择器不可用。

可清空单选

dd-select 设置 clearable 属性,则可将选择器清空。

无边框

无边框样式。

后缀图标

基础多选

dd-select 设置 multiple 属性即可启用多选, 此时 v-model 的值为当前选中值所组成的数组。

筛选选项

可以利用筛选功能快速查找选项。 为 dd-select 添加 show-search 属性即可启用搜索功能。 filter-option 为一个 Function,它会在输入值发生变化时调用,参数为当前输入值。

自定义模板

将自定义的 HTML 模板插入 dd-selectslot 中即可。

远程搜索

输入关键字以从远程服务器中查找数据。

大数据

dd-select 默认使用了虚拟滚动技术

Select API

Select Attributes

NameDescriptionTypeDefaultVersion
value(v-model)绑定值string | number | string[] | number[]
options通过 option ,自定义节点{ value: any; label?: any; disabled?: boolean; title?: any }[]
showSearch配置是否可搜索booleanfalse
placeholder输入框占位文本string
disabled禁用booleanfalse
size输入框尺寸large | default | small
filterOption是否根据输入项进行筛选。Function(inputValue, option)true
multiple多选模式booleanfalse
clearable是否可以清空选项booleanfalse
maxTagCount最多显示多少个 tagnumber
bordered无边框样式booleanfalse
generate是否立即生成组件示例booleanfalse

Select Events

NameDescriptionType
change仅当 modelValue 改变时(value, option) => void
select被选中时调用(value, option) => void
search文本框值变化时回调(value) => void
deselect取消选中时调用,仅在 multiple(value, option) => void
remove-tag移除 tag 时触发,仅在 multiple(value, option) => void
inputInput 值改变时触发(value) => void
clear在点击由 clearable 属性生成的清空按钮时触发() => void
dropdown-visible-change下拉框出现/隐藏时触发(visible) => void
blurinput 失去焦点时触发(e) => void
focusinput 获得焦点时触发(e) => void

Select Slots

NameDescription
dropdownRender自定义内容
suffixIcon后缀图标

贡献者

lazy

变更记录

cebe3 - fix: 修复select宽度问题 on 3/13/2025
bdfd0 - style: 修正样式 on 1/10/2024
01562 - style: 修正placeholder样式 on 1/10/2024
40905 - feat: 增加是否立即生成组件 on 1/3/2024
b4de2 - style: 修正icon样式 on 12/26/2023
1f9ff - style: 修改内边距 on 11/30/2023
f9517 - style: 修正select样式写法 on 11/21/2023
de8ee - style: 隐藏无边框模式阴影 on 11/20/2023
3244b - feat: select on 11/17/2023

Released under the MIT License.