List Table Select 列表选择器
通过数据驱动渲染多个表格选择器组件,适用于批量选择场景。
基础用法
通过 items 配置数组驱动渲染多个 WTableSelect 组件。
modelValue 为对象格式,key 对应 items 中每个配置项的 key 字段。
垂直布局
设置 layout 为 vertical 可以切换为垂直布局。
禁用状态
可以通过全局 disabled 禁用所有选择器,或通过单个 item 的 disabled 禁用特定选择器。
ListTableSelect API
Attributes
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| model-value / v-model | 绑定值,对象格式,key 对应 items 中的 key | object | {} |
| items | 列表选择项配置数组 | array | [] |
| disabled | 是否禁用所有选择器 | boolean | false |
| size | 全局尺寸设置,会被 item 中的 size 覆盖 | string | 'default' |
| clearable | 全局可清空设置,会被 item 中的 clearable 覆盖 | boolean | false |
| deletable | 全局可删除设置,会被 item 中的 deletable 覆盖 | boolean | false |
| addable | 是否显示添加按钮 | boolean | false |
| layout | 布局方式 | string | 'horizontal' |
| column-gap | 列间距(horizontal 布局时) | number / string | 16 |
| row-gap | 行间距(vertical 布局时) | number / string | 16 |
ListTableSelectItem 配置
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| key | 唯一标识 key | string | — |
| label | 标签文本 | string | — |
| placeholder | 占位文本 | string | — |
| options | 下拉选项数据 | array | — |
| columns | 表格列配置 | array | — |
| props | 选项字段映射配置,支持 prefixLabel 字段用于显示前置标签 | object | — |
| disabled | 是否禁用 | boolean | false |
| clearable | 是否可清空 | boolean | false |
| multiple | 是否多选 | boolean | false |
| size | 尺寸 | string | — |
| deletable | 是否可删除 | boolean | false |
| table-width | 表格宽度 | number / string | — |
| table-max-height | 表格最大高度 | number / string | — |
| placement | 弹出层位置 | string | — |
| popper-class | 弹出层类名 | string | — |
Events
| 事件名 | 说明 | 类型 |
|---|---|---|
| change | 当任意选择器值变化时触发 | Function |
| remove | 删除某项数据时触发 | Function |
| add | 点击添加按钮时触发 | Function |
Methods
| 方法名 | 说明 | 参数 |
|---|---|---|
| getValue | 获取某个 key 对应的值 | (key: string) |
| setValue | 设置某个 key 对应的值 | (key: string, value: any) |
| clearAll | 清空所有值 | — |
| clear | 清空某个 key 的值 | (key: string) |
| remove | 删除某个 key 并触发 remove 事件,由父组件移除 items 中对应项 | (key: string) |
Copyright 2025 Winning Health 版权所有
