{
title: "单据编号",
dataIndex: "billNo",
fixed: 'left',
width: 180,
customRender: (value, row, index) => {
const obj = {
children: value,
attrs: {},
};
if (index === 0) {
obj.attrs.rowSpan = 2;
}
return obj;
},
}
原因分析:由于第一行rowSpan为2占据了两行,导致第二条往下挤。
解决方法:下一行rowSpan设为0
{
title: "单据编号",
dataIndex: "billNo",
fixed: 'left',
width: 180,
customRender: (value, row, index) => {
const obj = {
children: value,
attrs: {},
};
if (index === 0) {
obj.attrs.rowSpan = 2;
}
if (index === 1) {
obj.attrs.rowSpan = 0;
}
return obj;
},
},
用取余数的方法循环判断:
customRender: (value, row, index) => {
const obj = {
children: value,
attrs: {},
};
if(index % 2 === 0) {
obj.attrs.rowSpan = 2;
} else {
obj.attrs.rowSpan = 0;
}
return obj;
},