selectTotalPrice() { let totalPrice = this.goods.reduce((prev, cur) => { const curPrice = cur.goods.sku?.price || cur.goods.price; return parseFloat(prev) + parseFloat((cur.is_select && curPrice) || 0) * cur.num; }, 0); return totalPrice; }
标签:goods,cur,price,reduce,parseFloat,数组,totalPrice,方法 From: https://www.cnblogs.com/hs20011205/p/17646655.html