vue3ElementPlu表格合并多行
// 单元格合并逻辑
const objectSpanMethod = ({ row, rowIndex, columnIndex }) => {
const previousMachineModelUniqueId =
rowIndex > 0 ? tableData.value[rowIndex - 1].machineModel : null;
const currentMachineModelUniqueId = row.machineModel;
// 合并“机型”列
if (columnIndex === 1) {
if (previousMachineModelUniqueId === currentMachineModelUniqueId) {
return { rowspan: 0, colspan: 0 };
}
const rowspan = tableData.value.filter(
item => item.machineModel === currentMachineModelUniqueId
).length;
return { rowspan, colspan: 1 };
}
return { rowspan: 1, colspan: 1 };
};
原文地址:https://blog.csdn.net/m0_51396253/article/details/142859834
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!