el-table代码:
<el-table
:data="arrangeClassManageTableData"
:span-method="objectSpanMethod"
border
style="width: 100%"
>
绑定的data数据arrangeClassManageTableData:x456
arrangeClassManageTableData: [
{
time: "2020/11/01",
classType: "白班",
monitor: "杨晓",
member: "周志远 杨瑞莹 刘敏 杨晓"
},
{
time: "2020/11/01",
classType: "夜班",
monitor: "刘茵",
member: "宋才寒 禄致芬 刀客 广影岚 简执娟"
},
{
time: "2020/11/02",
classType: "白班",
monitor: "杨晓",
member: "周志远 杨瑞莹 刘敏 杨晓"
},
{
time: "2020/11/02",
classType: "夜班",
monitor: "邱爱若",
member: "宋才寒 禄致芬 刀客 广影岚 简执娟"
},
]
methods中 objectSpanMethod 方法的编写
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
if (rowIndex % 2 === 0) {
return {
rowspan: 2,
colspan: 1
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
}
},
效果截图: