perf: 优化多文件上传入参是数组的情况 (#5757)

Co-authored-by: Jin Mao <50581550+jinmao88@users.noreply.github.com>
pull/62/head
zhang 2025-03-25 10:26:19 +08:00 committed by YunaiV
parent 919e2bf2c3
commit 9375ed110b
1 changed files with 7 additions and 1 deletions

View File

@ -16,7 +16,13 @@ class FileUploader {
const formData = new FormData(); const formData = new FormData();
Object.entries(data).forEach(([key, value]) => { Object.entries(data).forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach((item, index) => {
formData.append(`${key}[${index}]`, item);
});
} else {
formData.append(key, value); formData.append(key, value);
}
}); });
const finalConfig: RequestClientConfig = { const finalConfig: RequestClientConfig = {