Skip to content

ListInput ​

编辑一组结构相同的记录。每列用 renderInput 提供输入控件,支持添加、删除、校验以及拖动或键盘排序。

导入 ​

ts
import { ListInput } from '@astryx-vue/lab'

属性 ​

名称类型默认值说明
modelValueT[][]记录数组,使用 v-model。
labelstring必填列表标签和无障碍名称。
columnsListInputColumn<T>[]必填列定义和单元格渲染器。
getItemKey(item) => string | number必填返回记录唯一键。
createItem() => T必填添加时创建新记录。
description / itemNamestringundefined列表说明和操作使用的单数名词。
statusFieldStatusundefined整个列表的校验状态。
getItemStatus(item, index) => FieldStatusundefined单条记录的校验状态。
getFieldStatus(item, columnKey, index) => FieldStatusundefined单元格的校验状态。
isReorderablebooleanfalse是否允许排序。
isDisabled / isLoadingbooleanfalse禁用或忙碌状态。
maxItemsnumberundefined最大记录数。
isLabelHidden / isOptional / isRequiredbooleanfalse标签和必填标记。

列包含 key、header、可选 width 和 renderInput。渲染器会收到当前记录、无障碍标签、校验状态、禁用状态以及 updateItem,示例演示了如何接入 core 的 TextInput。

事件 ​

change 同时返回新数组和本次改动,改动类型为 add、update、remove 或 reorder。