js判断对象里的每个值是不是空

/**
* 判断对象的值是不是全为空
*/
objectValueAllEmpty:(object)=>{
	let isEmpty = true;
	Object.keys(object).forEach(function(x) {
	    if(object[x] != null && object[x] != ""){
		    isEmpty = false;
	    }
	});
	if(isEmpty){//值全为空
	    return true;
	}
	return false;
}

参数object是表单form的对象

猜你喜欢

转载自blog.csdn.net/qq_45617555/article/details/107702780