一般接口允许传参为空的话,就不需要用
let trans = { a:22, b:'' }; let pam = {} for(let i in trans){ if(trans[i]){ pam[i] = trans[i] } } console.log(pam);//{a:22}