操作方法如下:
new Vue({
el: '#app',
data:function(){
return {
lists:[
{name:1111,state:1},
{name:2222,state:2},
{name:3333,state:3}]
};
},
computed:{
red:function(){
for( var i = 0; i< this.lists.length; i++ ){
if( this.lists[i].state === 1 ){
return true;
}
}