在vue中,使用foreach循环数组里的每一条数据,其他的都没问题,但是在if语句里判断两个字段是否相等就不行了,都是只判断最后一条数据,请各位大神帮我看一下是怎么回事啊tog() { this.articleList.forEach((article) => {
if (this.search === article.title) { //就是这里的代码不能循环列表中的每一条数据
console.log(article.title)
this.show = false;
this.flag = false;
this.reveal = true;
this.resArr.push(article);
} else {
this.show = true;
this.flag = true;
this.reveal = false;
}
})
}
添加回答
举报
0/150
提交
取消