javascript reduce 前端交互 总计

 

 

 

 

sum(){
  return this.products.reduce((total,next)=>{
    return total + next.price * next.aumout},0)
}

数组.reduce((参数1,参数2)=>函数{},0参数末定义初始值0)

total ,初始为0. 参数。。

 v-for      数组循环

v-modle  取值

 

posted on 2019-10-07 14:40  卓达  阅读(192)  评论(0编辑  收藏  举报

导航