Skip to content

Table 表格 ​

基础用法(数组配置) ​

使用TableArrayColumns定义表单

使用TableObjectColumns定义表单

基础用法(对象配置) ​

插槽 ​

只需要配置slot就可以使用插槽

多级表头 ​

通过children来配置按钮

列的props ​

通过props可以配置el-table-column的props

列的按钮 ​

如果列中想要显示按钮但是又不想用插槽,可以使用buttons来配置按钮

列的显示与隐藏 ​

可以使用show来控制列的显示与隐藏

操作列 ​

可以使用actionprop在末尾添加“操作”列,列的标题默认为“操作”;action可以在[TableColums]抽离在另一个文件时使用

WARNING

推荐使用插槽

Table Attributes ​

TIP

除了下面的Attributes,您还可以传入el-table的原生props和事件,例如show-header、selection-change等,更多Attributes请看el-table文档

名称说明类型默认值
data表格数据array[]
options表格配置项TableColums
hiddenColsByLabel根据标题隐藏列array[]
action操作列object: {label?: String} & Omit<TableColumn, "children" | "slot">[]

TableColums ​

TableColums由TableArrayColumns和TableObjectColumns,都是由 TableColum 组成,其中TableObjectColumns对象上的value可以是字符串

名称说明类型是否必须默认值
label列的标题,优先级比props的label低string否
prop列内容的字段名,优先级比props的prop低string否
propsel-table-column的propsobject否
children子级列array:Array<TableColumn>否
buttons列内容的字段名,优先级比props的prop低ButtonOption否
show是否显示列show?: boolean | (() => boolean)否true
slot插槽名称string否

ButtonOption ​

名称说明类型是否必须默认值
label按钮的文字string否
propsel-button的props((scope: {row: any, column: any, $index:number}) => Partial<ButtonProps>) | Partial<ButtonProps>否
click点击按钮的事件Function否

MIT Licensed.