-
Notifications
You must be signed in to change notification settings - Fork 747
atinput组件输入单个字符后光标跳到最前边 #1836
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
Comments
请问你怎么处理这个问题的,我也遇到这个问题了 |
给每个AtInput 加cursor=-1 |
他这个是为什么呢? |
原因是什么呢,搞不懂 |
AtInput会倒着输入是因为这个问题吗? 我GitHub上搜了下taro的issue 看这个问题好像几年前就有提过 有说是微信版本也有问题, 这个问题和taro-ui的版本 taro版本跟微信版本都有关系? 还是说我只要加cursor=-1就可以完全解决的 |
cursor={value.length}就可以 |
@ramey502 cursor={value.length} 是不行的,这样做只是输入的时候可以,但是如果你光标定到中间部分,删除几个字,你会发现自动跳到最后了,又会产生新问题 |
用Taro自带的input是可以的,但是taro-ui的AtInput不行,因为AtInput源码里默认给cursor加了一个0 的默认值,而支付宝或者微信小程序的文档里,cursor的默认值是空而不是0,所以给一个cursor=-1的无效值去覆盖atinput的默认cursor值。 猜测是因为setState的时候不知道为什么把AtInput组件也给刷新了,导致render时每次cursor都使用默认值0 |
正常运行的微信小程序,过一段时间atinput组件就出现输入单个字符后光标跳到最前边
The text was updated successfully, but these errors were encountered: