vue.js v-for 里面计算属性怎么计算的
展开全部
操作方法如下:
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;
}
}
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;
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询