table
config
| 名称 | 类型 | 描述 |
|---|---|---|
| config | Array | 配置 详见config的配置列表 |
| tableData | Array | table的数据源 |
method
| 名称 | 传出参数 | 描述 |
|---|---|---|
| selectChange | selection 复选框选中的表格数据 | 返回表格中选中的复选框数据 |
| onClick | tableItem 所选中行的数据 childItem 选中行配置中所在的按钮配置数据 parentItem 选中行所在的配置详细数据 |
按钮列表中 |
config- config[Array]
| key | value | detail | 描述 | 优先级 |
|---|---|---|---|---|
| name | string | 姓名 | 表格中表头名称 | |
| key | string | username | 对应数据源中需要展示的key的值 | |
| width | string | 80px | 列宽度 例:80px | |
| fixed | boolean | false | 是否固定列 默认false | |
| isAction | object { btnList:Array } |
isAction: { btnList: [ { name: '编辑', key: 'edit', type: 'text' }, { name: '删除', key: 'delete', type: 'text' } ] } |
是否是操作按钮栏如果是则会展示按钮组 | 2 |
| isSlot | boolean | true | 是否插槽 | 1 |
| scopeList | Array | scopeList: { 1: '未认证', 2: '认证中', 3: '认证通过', 4: '认证失败', 5: '认证撤回' } | 行数据key的具体映射 | 3 |
| useKey | string | name | 如果scopeList没有找到对应的映射那么用数据源中那个key进行显示 | 同scopelist |
btnList
| 名称 | 值 | 描述 | |
|---|---|---|---|
| name | string | 按钮的名称 | |
| key | string | 按钮的key 需要对应 method onClick 传出的点击事件中进行判断是点击了那个按钮 | |
| type | string | string 对应element 中 button的type | |
| types | number | 用作判断按钮是否展示悬浮框 (待完善) | |
| subKey | string | 如果填写了 则会不使用name 使用行中对应subKey的值填写 |
配置实例
export const AboutTable:Array<tableList> = [
{
name: '操作',
key: 'Action',
width: '180px',
isAction: {
btnList: [
{
name: '添加',
key: 'add',
type: 'text'
},
{
name: '编辑',
key: 'edit',
type: 'text'
}
]
}
},
{
name: '测试',
key: 'name',
width: '180px',
fixed: false
}, {
name: '用户名',
key: 'userName',
fixed: false,
isAction: {
btnList: [
{
name: '查看详情',
key: 'seeDetail',
type: 'text',
subKey: 'userName'
}
]
}
},
{
name: '时间',
key: 'date',
fixed: false,
isSlot: true
},
{
name: '类型',
key: 'address',
scopeList: {
1: '你好',
2: '我不好'
}
}
];