Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[upload] files和defaultFiles 增加对数组类型和对象的判断 #2471

Closed
duxphp opened this issue Aug 27, 2023 · 4 comments
Closed

[upload] files和defaultFiles 增加对数组类型和对象的判断 #2471

duxphp opened this issue Aug 27, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request to be published fixed, not be published

Comments

@duxphp
Copy link
Contributor

duxphp commented Aug 27, 2023

这个功能解决了什么问题

放入表单使用中,从后端传递表单默认值可能为null或者undefined 但是upload组件必须要求是数组,如果是单文件或者是空就会导致报错,必须给默认表单数据做一层转换导致多出来很多工作,其他表单元素可能也有类似的需求

你建议的方案是什么

所有表单相关的元素的值或默认值为 null 或者 undefined

@github-actions
Copy link
Contributor

👋 @duxphp,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@github-actions
Copy link
Contributor

♥️ 有劳 @wookaoer @teal-front @carolin913 @chaishi 尽快确认问题。
确认有效后将下一步计划和可能需要的时间回复给 @duxphp

@HaixingOoO HaixingOoO added the enhancement New feature or request label Oct 6, 2023
@chaishi
Copy link
Collaborator

chaishi commented Nov 5, 2023

Select 组件处理过,在接受不了到非合法参数时,会自动进行一次转换,但这样的转换,为了保持受控,会多出来一个 onChange 事件

如果其他组件也要处理 null/undefined 这种异常数据,需要参考类似的方式。

先不说,后台传递的表单数据不考虑数据类型,一股脑传递 null/undefined 是否属于偷懒的做法。
我们先假如所有的组件都进行异常数据处理,都多出来一个 onChange 之后,这种 change 事件也会自动触发表单校验,是否符合预期? 对于表格类的查询条件,也会自动触发多次 change 事件之后的查询,此时是否也符合预期?

可能除了组件本身兼容支持外,业务也需要考虑下多了一个 change 错误参数矫正的事件时,该如何进一步处理

@chaishi
Copy link
Collaborator

chaishi commented Dec 16, 2023

support in #2671

@uyarn uyarn added the to be published fixed, not be published label Dec 28, 2023
@github-actions github-actions bot mentioned this issue Dec 28, 2023
16 tasks
@uyarn uyarn closed this as completed Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request to be published fixed, not be published
Projects
None yet
Development

No branches or pull requests

5 participants