修改
subCart(event){ //数量-- var that = this; var index = event.currentTarget.dataset.index; var item = this.data.shoppingCartDataList[index]; console.log(index); item.num = item.num - 1; if (item.num <= 1) { item.num =1; } var itemData = "shoppingCartDataList[" + index + "]"; that.setData({ [itemData]: item }); shopping_cart_update(item.id, item.num); //计算数量 this.cal_num(); },
站长微信:xiaomao0055
站长QQ:14496453