数组对象统计多个属性 用户07527272800 2023-12-18 48 阅读1分钟 const sum = data.reduce((accumulator, currentValue) => { const { left, width } = currentValue; return { left: accumulator.left - left, width: accumulator.width + width }; }, { left: 0, width: 0 });