$ui/components/my-table

表格组件, 扩展el-table

Source:

Members

(inner) props

Source:
Properties:
Name Type Attributes Default Description
title string <optional>

表格标题

toolbar boolean <optional>

显示工具条,需要开启toolbar, title才有效

headerBackground boolean <optional>

表格头显示背景色

data Array <optional>

表格数据,可通过data 或 loader 参数为表格加载数据

columns Array <optional>

表格列配置,支持全部el-table-column组件的参数,扩展支持设置 display 默认位true,在columnFilter=true时有效 如果要用插槽定义内容,必须要设置prop

columnFilter boolean <optional>

开启列筛选功能

mode string <optional>
pager

模式,支持页码分页、滚动分页、虚拟列表 三种,可选值:'pager', 'scroll', 'virtual'

loading boolean <optional>

显示加载中

spin Object <optional>

加载中的MySpin组件配置参数

fit boolean <optional>

适应父容器

page number <optional>
1

初始页码

pageSize number <optional>
10

初始每页显示几条

total number <optional>
0

记录总数

pagination Object <optional>

分页组件el-pagination的其他配置

Function <optional>

[loader] 数据加载函数,参数:page,pageSize, 必须返回Promise

auto boolean <optional>

初始化是否自动调用loader,如果需要手动调用设置为false

scrollDelay number <optional>
200

滚动加载节流时延,单位为ms

scrollDistance number <optional>
0

滚动加载模式,触发加载的距离阈值,单位为px

itemHeight number <optional>

虚拟列表模式,行的高度

columnSortable Object | Boolean <optional>
false

是否启用列拖拽排序, 可以配置Sortable个性化参数

rowSortable Object | Boolean <optional>
false

是否启用行拖拽排序, 可以配置Sortable个性化参数

freeze Boolean <optional>
true

冻结列表数据数组,如果需要对列表数据进行双向绑定,需要设置为false

filterConfirm Boolean <optional>
false

列表筛选组件是否使用确认按钮(默认为false)

属性参数

(inner) slots

Source:
Properties:
Name Type Description
title string

定义标题

actions string

定义操作区工具按钮

toolbar string

定义工具区内容,设置toolbar, title和actions将失效

prepend string

定义表格前的内容

append string

定义表格底部内容,与el-table append 插槽一致

empty string

定义无数据是显示内容,与与el-table empty 插槽一致

$prop string

作用域插槽,自定义列显示内容,$prop是动态值,表示字段名称,即el-table-column组件的prop参数值,与el-table-column的默认插槽一致

Properties
Name Type Description
header string

作用域插槽 定义列头显示,与el-table-column的header插槽一致

skeleton string

定义滚动加载表格的loading效果

complete string

定义滚动加载表格加载到没有更多时的效果

插槽

Methods

(inner) refresh(pageopt)

Source:

刷新列表

Parameters:
Name Type Attributes Default Description
page number <optional>
1

刷新的页码

Events

column-change

Source:

列筛选改变时触发

Parameters:
Name Type Description
columnPropNames Array.<String>

column-change-confirm

Source:

列表筛选点击确定时触发

Parameters:
Name Type Description
columnPropNames Array.<Array>

error

Source:

请求失败时触发

Parameters:
Name Type Description
e *

错误信息

success

Source:

请求成功时触发

Parameters:
Name Type Attributes Description
res object <optional>

请求响应数据