vue遍历data中某个字段,并累加

//定义                   

 let sum = 0;

 this.list.forEach((item) => {

          //遍历prodAllPrice这个字段,并累加

         sum += item.prodAllPrice;

 });

//返回

this.sum = sum;

猜你喜欢

转载自blog.csdn.net/qq_31122833/article/details/80235513