【发布时间】:2019-06-18 07:00:48
【问题描述】:
如何过滤last_login = null并获取array_values?
// for(let y=0; y<this.searchLogin.length; y++ ){
// for(let i=0; i<this.list.length; i++){
// if(this.list[y].last_login == null ){
// this.retval.push(this.newval[i])
// } else {
// null
// }
// }
// }
// this.newval = []
// this.newval = this.retval
// this.retval = []
更新:
var output = [];
for (var i=0; i < this.list.length ; ++i){
for(let i=0; i<this.list.length; i++){
if(this.list[y].profile.last_login == null ){
output.push(this.list[i]);
return output;
}
}
}
console.log('this is list',this.list) 输出:
【问题讨论】:
-
粘贴您的 JSON 数据,而不是附加屏幕截图。并尝试使用Array.prototype.filter
-
您的代码有什么问题?你能给我们一个minimal reproducible example 它正在运行吗?
标签: javascript mysql loops vue.js console