const temp = {};
const mergeCells = (text, array, columns) => {
let rowSpan = 0
if (array.length == 1) {
rowSpan = 1
} else {
if (text !== temp[columns]) {
temp[columns] = text
array.forEach((item, index, arr) => {
if (item[columns] === temp[columns]) {
rowSpan++
}
})
}
}
return rowSpan
};
{
title: 'demo',
align: "center",
dataIndex: 'name',
customRender: (text, record, index) => {
const obj = {
children: text,
attrs: {}
}
obj.attrs.rowSpan = mergeCells(text, this.datalist, 'name')
return obj
}
},
// this.datalist => table数据