📜  以角度计算价格相同的产品 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:57.543000             🧑  作者: Mango

代码示例1
increase_quantity(temp_package){
    if(temp_package.limit == temp_package.quantity){
      return alert("Can't add more")
    }else{
      temp_package.quantity++
      this.Price += temp_package.price
    }
  }

  decrease_quantity(temp_package){
      if(temp_package.quantity == 0){
        return alert("can't be in minus")
      }
      temp_package.quantity--
      this.Price -= temp_package.price
  }
  countPrice(){
     this.Price = 0;
      for(let p of this.packagesArray){
        this.Price += p.price*p.quantity
      }
  }