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

updateSchema的优化 #3459

Closed
zzc0217 opened this issue Dec 25, 2023 · 3 comments
Closed

updateSchema的优化 #3459

zzc0217 opened this issue Dec 25, 2023 · 3 comments

Comments

@zzc0217
Copy link

zzc0217 commented Dec 25, 2023

Subject of the feature

当前使用updateSchema,会重置默认值,如果结合了fieldMapToTime,当我在一些onchange或者onselect事件中,去操作了updateSchema,会影响到使用了fieldMapToTime的表单,假设我给使用fieldMapToTime默认值,在我选了一个时间以后,去操作有使用updateSchema的表单项,被导致我被选择的时间重置

Expected behaviour

想做到的是,选择时间以后,在我操作时,不要重置默认值

@xachary
Copy link

xachary commented Dec 29, 2023

@zzc0217

fieldMapToTime demo 里没有示例,用途是把某字段A(时间数组)拆分成 2 个单独的字段B、C么?
假设字段 A 默认值为 ['2023-12-29', '2023-12-30'],字段B、C的值变成('2023-12-29'、'2023-12-30')
然后,你修改了字段B、C的值变成('2023-12-28'、'2023-12-31')
接着,你 updateSchema,会再次触发 fieldMapToTime 逻辑,字段B、C的值又变回('2023-12-29'、'2023-12-30')
貌似逻辑也正常,你看看 updateSchema 之前,缓存字段B、C的值,updateSchema 之后再 setFieldsValue 回去行不行

@zzc0217
Copy link
Author

zzc0217 commented Jan 3, 2024

@zzc0217

fieldMapToTime demo 里没有示例,用途是把某字段A(时间数组)拆分成 2 个单独的字段B、C么? 假设字段 A 默认值为 ['2023-12-29', '2023-12-30'],字段B、C的值变成('2023-12-29'、'2023-12-30') 然后,你修改了字段B、C的值变成('2023-12-28'、'2023-12-31') 接着,你 updateSchema,会再次触发 fieldMapToTime 逻辑,字段B、C的值又变回('2023-12-29'、'2023-12-30') 貌似逻辑也正常,你看看 updateSchema 之前,缓存字段B、C的值,updateSchema 之后再 setFieldsValue 回去行不行

是可以的,但是这样太麻烦了 还需要用额外的操作去维护你之前做的操作

@anncwb
Copy link
Collaborator

anncwb commented Apr 9, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@anncwb anncwb added the Stale label Apr 9, 2024
@anncwb anncwb closed this as completed Apr 17, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants