1.简单的循环字段循环
if (this.videolist) { console.log(111); for (let j = 0; j < this.videolist.length; j++) { if (this.videolist[j].video) { this.showVIdeo = false; return; } else { this.showVIdeo = true; } } } else { console.log(222); this.showVIdeo = true; }
2.使用循环从接口获取数组对象的一个字段集合
let list= []; for (let j = 0; j < res.data.result.xxoptization.length; j++) { if(res.data.result.xxoptization[j].video){ let temporaryItem = {}; temporaryItem.video = res.data.result.xxoptization[j].video; temporaryItem.videoimg = res.data.result.xxoptization[j].videoimg; temporaryItem.videoname = res.data.result.xxoptization[j].videoname; temporaryItem.title = res.data.result.xxoptization[j].title; list.push(temporaryItem); } } this.videolist.push(...list);
转载于:https://www.cnblogs.com/Glant/p/10921549.html
最后
以上就是缥缈彩虹最近收集整理的关于简单的循环以及从接口获取数组对象的一个字段集合的全部内容,更多相关简单内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复