Merge remote-tracking branch 'origin/develop' into guanyu
This commit is contained in:
@@ -243,11 +243,20 @@ export function tansParams(params) {
|
||||
var part = encodeURIComponent(propName) + '=';
|
||||
if (value !== null && value !== '' && typeof value !== 'undefined') {
|
||||
if (typeof value === 'object') {
|
||||
for (const key of Object.keys(value)) {
|
||||
if (value[key] !== null && value[key] !== '' && typeof value[key] !== 'undefined') {
|
||||
let params = propName + '[' + key + ']';
|
||||
var subPart = encodeURIComponent(params) + '=';
|
||||
result += subPart + encodeURIComponent(value[key]) + '&';
|
||||
if (Array.isArray(value)) {
|
||||
// 数组:序列化为重复同名参数,兼容 Spring @RequestParam List 绑定
|
||||
for (const item of value) {
|
||||
if (item !== null && item !== '' && typeof item !== 'undefined') {
|
||||
result += part + encodeURIComponent(item) + '&';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const key of Object.keys(value)) {
|
||||
if (value[key] !== null && value[key] !== '' && typeof value[key] !== 'undefined') {
|
||||
let params = propName + '[' + key + ']';
|
||||
var subPart = encodeURIComponent(params) + '=';
|
||||
result += subPart + encodeURIComponent(value[key]) + '&';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user