在计算属性中,使用 reduce 方法计算table列表中某一列字段的所有行数据的累计和
computed: {
sumHjql(){ //多选合计气量
return this.dxhjql = this.noticeBillList.map(item=>item.ql + item.hjql).reduce(
(acc, cur) => (parseFloat(cur) + acc), 0)
},
this.selectionQl = this.noticeBillList.map(item=>item.hjql).reduce(
(acc, cur) => (parseFloat(cur) + acc), 0)
},