rubyc
2021-07-03 17:20
computed:{ listData(){ let list = JSON.parse(JSON.stringify(this.list)) let newList = [] if(this.activeIndex == 0){ newList = list } if(this.activeIndex == 1){ newList = list.filter(item => item.checked == false) } if(this.activeIndex == 2){ newList = list.filter(item => item.checked == true) } return newList } }
computed:{
listData(){
if(this.activeIndex === 0){
return this.list
}
if(this.activeIndex === 1){
return this.list.filter(i=>{
return i.checked != true
})
}
if(this.activeIndex === 2){
return this.list.filter(i=>{
return i.checked == true
})
}
}
},
把计算属性处理出函数,更好
uni-app 5小时快速入门
11124 学习 · 67 问题
相似问题