// 处理数据源
rowspan(tableDate) {
for (var i = 0; i < tableDate.length; i++) {
if (i === 0) {
this.spanArr.push(1)
this.pos = 0
} else {
// 判断当前元素与上一个元素是否相同
if (tableDate[i].notifyTemplateType === tableDate[i - 1].notifyTemplateType) {
this.spanArr[this.pos] += 1
this.spanArr.push(0)
} else {
this.spanArr.push(1)
this.pos = i
}
}
}
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
const _row = this.spanArr[rowIndex]
const _col = _row > 0 ? 1 : 0
return {
rowspan: _row,
colspan: _col
}
}
},
vue合并行
最新推荐文章于 2024-05-16 12:43:50 发布