<el-table v-loading="listLoading" border :data="list" default-expand-all row-key="id" show-summary :summary-method="getSummaries">
const getSummaries = (res) => {
const { columns, data } = res
console.log(columns, res);
const sum = []
columns.forEach((element, index) => {
if (index == 0) {
sum[index] = '总计'
}
if (index == 4) {
//cur.wxAmount 合计对象的数字
sum[index] = data.reduce((pre, cur) => pre + Number(cur.wxAmount), 0)
sum[index] = sum[index].toFixed(2)
}
});
return sum
}