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

[Bug Report] schema 里的 default 值会覆盖原来的空字符串 #2629

Closed
1 task
Jiazhi-Wong opened this issue Dec 15, 2021 · 1 comment · Fixed by #2906
Closed
1 task

[Bug Report] schema 里的 default 值会覆盖原来的空字符串 #2629

Jiazhi-Wong opened this issue Dec 15, 2021 · 1 comment · Fixed by #2906

Comments

@Jiazhi-Wong
Copy link

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

demo直接重现

What is expected?

form.values.input 保持空字符串

What is actually happening?

form.values.input 的值为"默认值"

Package

@formily/[email protected]


1、input字段会有一个默认值,如schema所见
2、第一次表单编辑的时候,运营把默认值清掉,点了保存
3、所以重新编辑的时候,input字段就是空字符串了,但是这时formily用default值覆盖了原有的空字符串

请问这种场景怎么避免空字符串被覆盖?

@janryWang
Copy link
Collaborator

需求不合理,如果值为空,必然会走到默认值逻辑里去

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 a pull request may close this issue.

2 participants