计算属性 定义在 computed方法里面
computed:{
fullStatus(){
return this.list.every(item => item.goods_state)
},
amt(){
return this.list.filter(item=>item.goods_state)
.reduce((total ,item)=>(total += item.goods_price * item.goods_count),0)
},
allCount(){
return this.list.filter(item=>item.goods_state).length
}
},
使用 直接 引用即可
Footer :full="fullStatus" @changeStatus="getNewFullStatus" :allPrice="amt" :allCount="allCount"></Footer>
filter是 过滤
reduce累加
every