Write a judgment sentence with vue framework to judge that when goods are added to a shopping cart, the quantity of the same kind of goods is added, and there can be no two records of the same kind of goods.

1. Problem: write a judgment sentence with vue framework to judge that when goods are added to a shopping cart, the quantity of the same item is added, and two records cannot appear for the same item

  1. I write
like this

/ / add to the shopping cart

addShopcart(item, index) {
  function getUniqueKey(item) {
    return "" + goods.sku_code + goods.sku_id;
  }
  let goods = $global.deepCopy(item);
  let isEqual = false;
  for(let i = 0; i < this.list.length; iPP) {
    if(getUniqueKey(this.list[i]) === getUniqueKey(goods)) {
      isEqual = true;
      this.list[i].item.amount = Number(this.list[i].item.amount);
      
      this.list[i].item.amount += Number(this.list[i].item.amount); 
      break;
    }
    if(!isEqual) {
         this.list.push(goods);
            
  }
   let user_id=localM.get("user_id");
      localM.set(user_id+"shopcartList", this.list, true);
      Message.success({message: "", center: true});
        }
  
  
},
3.:
Jun.29,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be56c3-30cc0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be56c3-30cc0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?