下面这个for循环是按照key来遍历一个对象,在遍历的同时,对对象中的值进行操作,如果符合条件,就将符合条件的删除
for(name in this.search){
if(this.search[name] == '' || this.search[name] == '-1' || !this.search[name]){
delete this.search[name];
}
}
这个是将带有中国时间这样的时间,转换为我们正常看到的2018-10-19 18:11:15这样子的
let start_date_value = "";
let end_date_value = "";
if (this.search.start_at) {
var date = new Date(this.search.start_at._d);
start_date_value = date.getFullYear() + '-' + (date.getMonth() + 1)
+ '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
this.search.start_at = start_date_value;
}