vue 练手demo todolist,年薪50W

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()

}

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值