element-ui表格行合并

arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
let lengthList = [
{ len: 2, startIndex: 0 },
{ len: 3, startIndex: 0 },
{ len: 4, startIndex: 0 },
{ len: 5, startIndex: 0 }
]
const lastIndex = 5
let sum = 0
lengthList.forEach(item => {
item.startIndex = sum
sum += item.len
})
let getSign = false
for (var i = 0; i < lengthList.length; i++) {
if (rowIndex == lengthList[i].startIndex) {
getSign = true
return {
rowspan: lengthList[i].len,
colspan: 1
};
}
}
if (!getSign) {
return {
rowspan: 0,
colspan: 0
}
}
}
},

猜你喜欢

转载自www.cnblogs.com/yangyang03/p/9281703.html