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

实现一个好用又漂亮的验证码/证件号输入框组件 #13

Open
qppq54s opened this issue Apr 15, 2021 · 0 comments
Open

实现一个好用又漂亮的验证码/证件号输入框组件 #13

qppq54s opened this issue Apr 15, 2021 · 0 comments

Comments

@qppq54s
Copy link
Owner

qppq54s commented Apr 15, 2021

需求内容

功能:实现自定义的输入框组件,限制可以输入英文或者数字,长度限制为4位。
美观:4个输入框单独展示【】【】【】【】

实现

方案1

四个单独的input框,限制只能输入英文或数字。
问题: 切换输入框时,ios键盘会重制,导致ios手机使用系统默认键盘时,如果输入4个数字,需要多次切换输入法,体验不好。

方案2

自己写四个假的输入框,同时写一个input组件,并通过opacity:0设置为透明
问题:在ios手机上,使用中文键盘输入时,待选英文之间存在空格,假的输入框如果和input内容一直,容易令人疑惑。

方案3

此方案基于方案二优化,因中文键盘原因,最好能限制ios系统键盘唤出时,只支持输入英文或数字。当input组件的type设置为password时,ios系统键盘会唤起密码输入特殊键盘,只包括英文数字和特殊字符,只需过滤特殊字符即可。

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