Vue第六篇之Vue遍歷data中某個字段,並累加、算總數,總計(this.list.forEach方法實戰)

 直接上代碼,遍歷data中prodAllPrice,並累加、算總數,總計(this.list.forEach方法實戰):this //定義                    let sum = 0; this.list.forEach((item) => {    //遍歷prodAllPrice這個字段,並累加    sum += item.prodAllPrice;  }); //返回
相關文章
相關標籤/搜索