el-table树形数据父级单元格行合并
实现效果:
代码:
<el-table :data="tableData" style="width: 100%; margin-bottom: 20px" :span-method="arraySpanMethod" border row-key="id" :tree-props="{children: 'children',hasChildren: 'hasChildren',}"> // 合并行 arraySpanMethod(row, column, rowIndex, columnIndex) { // 只有父级数据才有children if (row && row.row.children) { return [1, 4]; } },