以下是合并行,合并列时把所有的rowSpan 换成colSpan
1.html—table引入(:dataSource=“makeData(dataSource.data)”)
<a-table :scroll="{y: dataSource.rowsHeight,x:1800}" :customRow="customHover" bordered
:columns="columns" :dataSource="makeData(dataSource.data)"
:pagination="false" :locale="{emptyText: '暂无数据'}">
2.js定义变量columns(谁要合并就要定义customRender)
const columns = [
{
title: "故障类别",
dataIndex: "issueType",
width: 200,
scopedSlots: { customRender: "issueType" },
customRender: (value, row) => {
const obj = {
children: row.issueType,
attrs: {},
};
obj.attrs.rowSpan = row.rowSpan;
return obj;
},
},
...
]
3.methods定义方法,处理数据