Skip to content

Conversation

@GATING
Copy link
Contributor

@GATING GATING commented Mar 5, 2025

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

[Upload] 文件数组上传不支持#4188

💡 需求背景和解决方案

修改前:

image

当多个文件一个请求上传,file这个参数被转成了字符串[object File],[object File],这个是无意义的。
且后端也可能会接收数组形式的参数。

修改后:

image

📝 更新日志

  • feat(Upload): 请求参数支持数组

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@tdesign-bot
Copy link
Collaborator

TDesign Component Repositories CI Test Open

Component Lint Test Build
tdesign-vue
tdesign-vue-next
tdesign-react
tdesign-web-components
tdesign-mobile-vue
tdesign-mobile-react

@HaixingOoO HaixingOoO requested a review from Copilot March 6, 2025 09:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds support for sending array parameters in the Upload request by modifying the FormData construction logic.

  • Introduces a check for array values in requestData to append each element individually
  • Maintains backward compatibility by appending non-array values as before

Reviewed Changes

File Description
js/upload/xhr.ts Enhances FormData handling to support array values in requestData

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

js/upload/xhr.ts:84

  • [nitpick] Appending array elements using the same key may not be properly recognized by all backends. Consider appending array fields with a modified key (e.g. 'key[]') or verifying that the backend correctly handles multiple entries for the same key.
if (Array.isArray(dataValue)) {

@uyarn uyarn merged commit bf513e7 into Tencent:develop Nov 18, 2025
8 checks passed
@uyarn
Copy link
Collaborator

uyarn commented Nov 19, 2025

/pr-react

@tdesign-bot
Copy link
Collaborator

/pr-react

创建 PR 成功, 请查看 Tencent/tdesign-react#3967

@uyarn
Copy link
Collaborator

uyarn commented Nov 19, 2025

/pr-vue-next

@tdesign-bot
Copy link
Collaborator

/pr-vue-next

创建 PR 成功, 请查看 Tencent/tdesign-vue-next#6169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants