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

希望Form增加formatter与parser #34281

Closed
1 task
Phyzait opened this issue Mar 3, 2022 · 3 comments
Closed
1 task

希望Form增加formatter与parser #34281

Phyzait opened this issue Mar 3, 2022 · 3 comments

Comments

@Phyzait
Copy link

Phyzait commented Mar 3, 2022

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

Upload组件封装结合时,传入的初始值往往是stringstring[],此时需要转换为UploadFile[],而输出时需要从UploadFile[]转换为stringstring[]
而现有的normalize等方法似乎难以实现,因为UploadFile中也包含了文件的当前状态(上传中、上传失败等)等信息,由多转少(UploadFile转string)容易,而由少转多难(string转UploadFile)
若每次都在onFinish方法中处理请求会产生很多冗余代码。
希望可以给出解决方案或建议~

What does the proposed API look like?

formatter方法在传入初始值时,转为指定类型。
parser方法在Form表单提交时,转为指定类型。

@Phyzait
Copy link
Author

Phyzait commented Mar 3, 2022

已阅读 #19727 等 issue~ 感觉没有这两个属性还是很难搞的~

@afc163
Copy link
Member

afc163 commented Mar 3, 2022

建议自行封装一个高阶组件,这个在 Form.Item 上加属性会更复杂。

@afc163 afc163 closed this as completed Mar 3, 2022
@Phyzait
Copy link
Author

Phyzait commented Mar 3, 2022

建议自行封装一个高阶组件,这个在 Form.Item 上加属性会更复杂。

目前是的,忽略了value的更新,把fileList的处理都在内部消化了

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

No branches or pull requests

2 participants