1、页面效果
2、table
3、
watch: {
implementationList: {
handler(n, o) {
this.getSpanArr(this.implementationList)
},
immediate: true
}
},
methods: {
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 1 || columnIndex === 2) {
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col
};
}
},
getSpanArr(data) {
console.log("zmmm--",data)
this.spanArr = [];
this.pos = 0;
for (var i = 0; i < data.length; i++) {
if (i === 0) {
this.spanArr.push(1);
this.pos = 0;
} else {
if (data[i].itemCode === data[i - 1].itemCode || data[i].itemName === data[i - 1].itemName) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = i;
}
}
}
},
}