看到有人說直接在li里的v-for這樣寫v-for=“(item,index) in productList”,刪除方法就可以delProduct:function(index){
this.productList.splice(index,1);
this.delFlag = false;
}
測試出來 如果點(diǎn)擊全選按鈕 然后刪除其中任何一個(gè)商品,都是默認(rèn)刪除的第一個(gè)商品,感覺還是要按照老師的方法來獲取索引
this.productList.splice(index,1);
this.delFlag = false;
}
測試出來 如果點(diǎn)擊全選按鈕 然后刪除其中任何一個(gè)商品,都是默認(rèn)刪除的第一個(gè)商品,感覺還是要按照老師的方法來獲取索引
2018-01-24
點(diǎn)擊結(jié)賬的時(shí)候,判斷一下總金額是否大于0,否的話阻止默認(rèn)事件就行,
2018-01-18
單選全部選擇觸發(fā)全選:var arr=[],
_this=this;
this.productList.forEach(function(item,index){
if (item.checked) {
arr.push(index);
}
})
if (arr.length==this.productList.length) {
this.checkFig(true);
}else{
this.checkAll=false;
}
_this=this;
this.productList.forEach(function(item,index){
if (item.checked) {
arr.push(index);
}
})
if (arr.length==this.productList.length) {
this.checkFig(true);
}else{
this.checkAll=false;
}
2018-01-18
this.ShopCart.forEach(function(item, index) {
if(item.checked) {
_this.checkAllFlog = true;
} else {
_this.checkAllFlog = false;
}
})
這段代碼貌似有BUG,點(diǎn)擊最后一個(gè)單選會(huì)觸發(fā)多選
if(item.checked) {
_this.checkAllFlog = true;
} else {
_this.checkAllFlog = false;
}
})
這段代碼貌似有BUG,點(diǎn)擊最后一個(gè)單選會(huì)觸發(fā)多選
2018-01-18
這個(gè)老師真的很有禮貌,結(jié)束語都是謝謝大家,我們才要謝謝老師才對(duì)啊
2018-01-17
做了一些總結(jié)與分析,里面有未開發(fā)的源碼和已經(jīng)完成的代碼,求圍觀,求建議。地址:https://github.com/CruxF/Vue-base
2018-01-16