共计 318 个字符,预计需要花费 1 分钟才能阅读完成。
const filterNullParams = (params, allValue) => {Object.keys(params).filter(
key => (params[key] === ''
|| params[key] === undefined
|| params[key] === null
)
&& delete params[key]
);
return params;
}
const queryList = () => {
const reqData = {
a: 1,
b: '',
c: -1,
}
axios.get('xxxxxxx', { params: filterNullParams(reqData) })
.then(res => res.data)
.then((res) => {// 代码});
}
正文完