Skip to content

ColumnForms 多表单列

说明

基于 el-table-column + el-form-item 封装,用于在表格的单元格内展示多个表单项,支持表单验证、条件显示等功能。

该组件需要配合 y-tableel-form 使用,每个表单项通过具名插槽的方式自定义内容,插槽名称与每个表单项配置的 prop 属性对应。

用法示例

基础用法

字段列表

API

Attributes

属性名说明类型默认值
options表单项配置数组object[]
inlineflex-wrap 行为来控制表单排列booleantrue
t-nameform中table字段名,用于绑定校验组string'tableData'
label显示的列标题string
prop列内容的字段名, 也可以使用 property属性string
width列的宽度,固定的string / number'auto'
min-width列的最小宽度,会把剩余宽度按比例分配给设置了 min-width 的列string / number100
fixed列是否固定在左侧或者右侧。 true 表示固定在左侧 trueenum / booleanfalse
render-header列标题 Label 区域渲染的函数Function
resizable是否可以通过拖动改变宽度(需要在 el-table 上设置 border=true)booleantrue
show-overflow-tooltip当内容过长被隐藏时显示 tooltipboolean / objectfalse
align内容对齐方式enum'left'
header-align表头对齐方式, 若不设置该项,则使用表格的对齐方式enum'left'
class-name列的 classNamestring'y-column-forms'
label-class-name当前列标题的自定义类名string

ColumnFormsItem

属性名说明类型默认值
prop表单项的字段名,必填string
label表单项的标签string
labelWidth表单项标签宽度string / number
rules表单验证规则object / Function
formAttrs表单项的其他属性object / Function
show是否显示表单项boolean / Functiontrue
width表单项宽度string / Functionauto
tipProps错误提示tooltip的属性object / Function{popperClass:'y-column-form__error-tooltip',effect:'dark',placement:'top',enterable:false}
style表单项样式object / Function

Slots

名称说明参数
[prop]具名插槽,根据 options 中每个表单项的 prop 属性命名,用于自定义表单项内容object
header自定义表头内容object