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

Input的值无法恢复成undefined #6283

Closed
zzcwzhang opened this issue Aug 4, 2023 · 5 comments
Closed

Input的值无法恢复成undefined #6283

zzcwzhang opened this issue Aug 4, 2023 · 5 comments

Comments

@zzcwzhang
Copy link

Version of antd-mobile

5.21.0

Operating system and its version

iOS, Android, Others

Browser and its version

Google Chrome 115 IOS 16.2

Sandbox to reproduce

No response

What happened?

Input组value与显示不同步
当我在第一个页面编辑Input后,通过其他方式将缓存的value设置为undefined
Xnip2023-08-04_12-03-21
再次进入这个页面发现Input显示的还是上次的value值,实际上value已经是undefined了
2

image

Relevant log output

No response

@zzcwzhang zzcwzhang added the bug label Aug 4, 2023
@IronKinoko
Copy link
Collaborator

设置 undefined 会成为非受控状态,你需要设置成 '' 空字符串

@1587315093 1587315093 added need reproduce We cannot reproduce your problem and removed bug labels Aug 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

Hi, zzcwzhang.

Please provide a online reproduction so that we can help you troubleshoot the problem. You can create a demo by codesandbox or stackblitz.

我们需要你提供一个在线的重现实例,以便于我们帮你排查问题。你可以通过 codesandboxstackblitz 创建一个实例。

@miracles1919 miracles1919 removed the need reproduce We cannot reproduce your problem label Aug 6, 2023
@zzcwzhang
Copy link
Author

设置 undefined 会成为非受控状态,你需要设置成 '' 空字符串

抱歉,这种方案在我们目前的系统中并不可取,因为undefined和空字代表着截然不同的两种状态,对于我们都有特殊含义。能否像antd的input一样支持undefined?

@1587315093
Copy link
Contributor

设置 undefined 会成为非受控状态,你需要设置成 '' 空字符串

抱歉,这种方案在我们目前的系统中并不可取,因为undefined和空字代表着截然不同的两种状态,对于我们都有特殊含义。能否像antd的input一样支持undefined?

自己 typeof 一下吧,总有办法来解决得

@zzcwzhang
Copy link
Author

好的好的,感谢你们伟大的工作

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

4 participants