数组元素实现累加

this.vehicleEcuNum = [{ecuId: '1,2,3'},{ecuId: '4,5,6'}]

this.vehicleEcuNum = this.dataList
        .map((item) => {
          return item.ecuId.split(',').length
        })
        .reduce((x, y) => x + y)
posted @ 2022-08-01 13:54  sinceForever  阅读(76)  评论(0编辑  收藏  举报