计算 单个数据 数组数据
单个数据
computed: {
sum: function () {
return parseFloat(this.count * this.price).toFixed(2);
},
},
数组数据
computed:{
total:function(){
let total = 0;
this.list.forEach((item)=>{
if(item.price && item.price > 0){
total += parseFloat(item.price );
}
})
return total;
},
},
!!

浙公网安备 33010602011771号