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

关于react中input的autofocus(自动聚焦)属性无法生效的问题 #153

Open
ckinmind opened this issue Jan 8, 2019 · 0 comments
Open

Comments

@ckinmind
Copy link
Owner

ckinmind commented Jan 8, 2019

问题描述:发现在react中input里写autofocus的属性在第一次渲染生效了,但是将input销毁后再次渲染时,这个属性就不再生效,也就是无法再次自动获取焦点,使用的场景是开始时搜索input是隐藏的,然后点击一个搜索的icon,然后展示搜索框,并且搜索框自动聚焦,然后再页面别的位置点击,搜索框隐藏,再点击搜索icon再显示,第一次可以自动聚焦,第二次不行

问题解决React and autofocus, 还是要用ref解决问题

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

1 participant