vue实现淘宝购物车功能

2020-06-16 06:56:55易采站长站整理

var caculNum = spanList[i].innerHTML;
if(caculNum < 2){
Toast('宝贝不能再少了哦');
}else{
caculNum --
spanList[i].innerHTML = caculNum;
}
}
}
if(event.currentTarget.parentNode.parentNode.parentNode.children[0].children[0].checked){
this.caculate();
}
},
//数量增加
numAdd: function(num){
var spanList = event.currentTarget.parentNode.children;
//console.log(event.currentTarget.parentNode.children)
for(var i = 0,len = spanList.length;i<len;i++){
if(spanList[i].getAttribute("class") == 'beeforCacul'){
spanList[i].style.display = 'none';
}
if(spanList[i].getAttribute("class") == 'cacul'){
spanList[i].style.display = 'block';
var caculNum = spanList[i].innerHTML;
caculNum ++;
spanList[i].innerHTML = caculNum;
}
}
if(event.currentTarget.parentNode.parentNode.parentNode.children[0].children[0].checked){
this.caculate();
}
},
//去结算
cauSum:function(){
if(this.sumPrice === 0){
Toast('您还没有选择宝贝哦');
}else{
this.$router.push('/cart/order')
}
},
}
};