{"size": 405, "ext": "js", "max_stars_repo_path": "src/store/actions.js", "max_stars_repo_name": "chenyr404/supermall_learn", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/store/actions.js", "max_issues_repo_name": "chenyr404/supermall_learn", "max_issues_repo_issues_event_min_datetime": "2021-05-11T19:12:20.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T07:44:35.000Z", "max_forks_repo_path": "src/store/actions.js", "max_forks_repo_name": "chenyr404/supermall_learn", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 23.8235294118, "max_line_length": 84, "alphanum_fraction": 0.5901234568}
export default {
  addCart(context,payload){
    return new Promise((resolve,reject) => {
      let oldproduct = context.state.cartList.find(item => item.iid === payload.iid)

      if(oldproduct){
        context.commit('addCounter',oldproduct)
        resolve('购物车商品+1')
      }else {
        payload.count = 1
        context.commit('addTocart',payload)
        resolve('已添加到购物车')
      }
    })
  }
}
