const filteredObj = Object.fromEntries( Object.entries(obg).filter(([key, value]) => { // 过滤空值 return value !== '' && value !== null && value !== undefined; }) ); console.log(filteredObj);