小程序请求参数为null或undefined传到后端为对应的字符
作者:
斡旋_ASL | 来源:发表于
2021-07-28 09:08 被阅读0次function requestParamHandler(params: any): any {
if (typeof params == "object") {
for (let key of Object.keys(params)) {
if (params[key] == null) {
delete params[key];
}
if (params[key] instanceof Array) {
const arr: any[] = [];
const list: any[] = params[key];
for (let listElement of list) {
const abj = requestParamHandler(listElement);
abj && arr.push(abj);
}
params[key] = arr;
}
}
}
return params;
}
本文标题:小程序请求参数为null或undefined传到后端为对应的字符
本文链接:https://www.haomeiwen.com/subject/xlzamltx.html
网友评论