我知道表格元素有汇总方法。我的问题是,有没有可能实现行跨摘要的方法?
我的想法是重新扫描表数据,并为行跨记录插入新数据:对于相同的ID,我需要插入一个新的摘要记录。因此,表数据应具有3个新的摘要记录
tableData: [{
id: '12987122',
name: 'Tom',
amount1: '234',
amount2: '3.2',
amount3: 10
}, {
id: '12987122',
name: 'Tom',
amount1: '165',
amount2: '4.43',
amount3: 12
}, {
id: '12987124',
name: 'Tom',
amount1: '324',
amount2: '1.9',
amount3: 9
}, {
id: '12987124',
name: 'Tom',
amount1: '621',
amount2: '2.2',
amount3: 17
}, {
id: '12987126',
name: 'Tom',
amount1: '539',
amount2: '4.1',
amount3: 15
}],
重置表数据后
tableData: [{
id: '12987122',
name: 'Tom',
amount1: '234',
amount2: '3.2',
amount3: 10
}, {
id: '12987122',
name: 'Tom',
amount1: '165',
amount2: '4.43',
amount3: 12
}, {
id: '12987122',
name: 'summary',
amount1: 'xxx',
amount2: 'xxx',
amount3: xxx
}, {
id: '12987124',
name: 'Tom',
amount1: '324',
amount2: '1.9',
amount3: 9
}, {
id: '12987124',
name: 'Tom',
amount1: '621',
amount2: '2.2',
amount3: 17
}, {
id: '12987124',
name: 'summary',
amount1: 'xxx',
amount2: 'xxx',
amount3: xxx
}, {
id: '12987126',
name: 'Tom',
amount1: '539',
amount2: '4.1',
amount3: 15
}, {
id: '12987126',
name: 'Summary',
amount1: 'xxx',
amount2: 'xxx',
amount3: xxx
}],