标签:cell bsp tsp column rgba objects color nbsp obj
// 合并 objectSpanMethod({ row, column, rowIndex, columnIndex }) { let $rowIndex = rowIndex; let fields = ["rectificationNo"]; //需要合并的字段 let cellValue = row[column.property]; let data = this.tableData; // 表格的所有数据, if (cellValue && fields.includes(column.property)) { let prevRow = data[$rowIndex - 1]; let nextRow = data[$rowIndex + 1]; if (prevRow && prevRow[column.property] === cellValue) { return { rowspan: 0, colspan: 0 }; } else { let countRowspan = 1; while (nextRow && nextRow[column.property] === cellValue) { nextRow = data[++countRowspan + $rowIndex]; } if (countRowspan > 1) { return { rowspan: countRowspan, colspan: 1 }; } } } },
在el-table 表格上添加:span-method="objectSpanMethod"
标签:cell bsp tsp column rgba objects color nbsp obj
原文地址:https://www.cnblogs.com/cyf-1314/p/14918026.html