this.numlist = this.list.length;
if(this.list.length>=1){
this.flag=true;
this.flag2=false;
}else{
this.flag=false;
this.flag2=true;
}
},
//点击复选框 将event和index传入
chooseItem(e,index){
//console.log(this.$refs.isItem[0].style)
//console.log(e.target.checked)
//判断如果选中
if(e.target.checked==true){
//console.log(index)
this.$refs.isItem[index].style.color = ‘#ccc’
this.$refs.isItem[index].style.textDecoration = ‘line-through’
let checkNum = $(“input[type=‘checkbox’]:checked”).length
//console.log($(“input[type=‘checkbox’]:checked”).length);
this.numlist=this.list.length-checkNum;
}
//如果未选中
else if(e.target.checked==false){
//console.log(“2”)
this.$refs.isItem[index].style.color = ‘#000’
this.$refs.isItem[index].style.textDecoration = ‘none’
let checkNum = $(“input[type=‘checkbox’]:checked”).length
//console.log($(“input[type=‘checkbox’]:checked”).length);
this.numlist=this.list.length-checkNum;
}
},
//所有计划
allList(){
$(‘#allList’).children(‘li’).show();
},
//未完成计划
unfinished(){
//让所有选中的input的父元素全部隐藏 未完成
$(“input[type=‘checkbox’]:checked”).parent().hide()
$(“input[type=‘checkbox’]:not(:checked)”).parent().show()
//let unfinishedNum = this.list.length-checkNum;
},
//已完成计划
finished(){
$(“input[type=‘checkbox’]:checked”).parent().show()
$(“input[type=‘checkbox’]:not(:checked)”).parent().hide()
}
}
}