Skip to content

SelectList 选择列表

面向“卡片式选择”的表单组件,支持单选、多选、最大可选数、禁用项、图标、描述文案与网格列数。

单选

vue
<lk-select-list v-model="value" :options="options" />

多选

vue
<lk-select-list v-model="values" multiple :options="options" />

最大可选数

vue
<lk-select-list
  v-model="values"
  multiple
  :max="2"
  :options="options"
  @overlimit="onOverlimit"
/>

网格布局

vue
<lk-select-list v-model="values" multiple :columns="2" :options="options" />

API

Props

参数说明类型默认值
v-model绑定值;单选为基础值,多选为数组string / number / boolean / array''
options选项列表SelectListOption[][]
multiple是否多选booleanfalse
disabled是否禁用booleanfalse
max最大可选数,0 表示不限制number0
titleKey标题字段名stringlabel
valueKey值字段名stringvalue
descKey描述字段名stringdescription
disabledKey禁用字段名stringdisabled
icon右侧选中图标stringcheck-all
showIcon是否显示右侧选中图标booleantrue
selectedBg选中时是否显示背景booleantrue
selectedBorder选中时是否显示边框booleantrue
bordered是否显示普通边框booleantrue
inset是否使用内嵌卡片间距booleanfalse
columns列数,1 为列表,2/3/4 为网格number1
itemRadius选项圆角string / number''
size尺寸sm / md / lgmd
activeColor选中颜色string''

Option

字段说明类型
label展示标题string
value选项值string / number / boolean
description描述文案string
disabled是否禁用boolean
icon左侧图标名string

Events

事件名说明回调参数
update:modelValue值变化时触发(value)
change选中值变化(value, option)
select单项选中状态变化(option, selected)
overlimit超过最大可选数(option, max)

Demo

项目演示位于 src/components/demos/select-list-demo.vue

基于 MIT 协议开源 · 粤ICP备2022114240号-3

SelectList 选择列表

正在连接预览服务...

请先运行 pnpm run dev:h5