当前位置:网站首页>Input输入框光标在前输入后自动跳到最后面的bug
Input输入框光标在前输入后自动跳到最后面的bug
2022-08-01 03:00:00 【站在28楼听风】
组件库:tea-component
技术框架:umi、react、react-hook-form
今日bug,输入框光标在最前面输入后自动跳到了最后面
输入前

输入后

触发事件不同,其余条件完全相同情况下
// onChange 会出现此bug
<Input
{...field}
onChange={(v) => {
handleChangeCache(v, 'name', true);
}}
maxLength={30}
disabled={cacheEventInfo?.isDistabled}
autoComplete="off"
placeholder={intl('name')}
/>
// onInput 不会出现此bug
<Input
{...field}
onInput={(v) => {
handleChangeCache((v?.target as any)?.value, 'name', true);
}}
maxLength={30}
disabled={cacheEventInfo?.isDistabled}
autoComplete="off"
placeholder={intl('name')}
/>此bug发生的原因猜测,tea-component组件对onChange组件进行了一次封装 ,而没有对onInput封装导致
具体原因欢迎大家指点

解决方法:将onChange事件改成onInput
边栏推荐
猜你喜欢

HCIP (14)

Google Earth Engine - Error resolution of Error: Image.clipToBoundsAndScale, argument 'input': Invalid type

带wiringPi库在unbutu 编译 并且在树莓派运行
![[Search topic] After reading the inevitable BFS solution to the shortest path problem](/img/f8/fbe906106dc8f7f7a6bd54d2dc3bc1.png)
[Search topic] After reading the inevitable BFS solution to the shortest path problem

Flutter “Hello world“ 程代码

how to edit the table of contents of an epub ebook

How to download the Keil package

MYSQL two-phase commit

更换树莓派内核

解决安装MySQL后,Excel打开很慢的问题
随机推荐
初出茅庐的小李第112篇博客项目笔记之机智云智能浇花器实战(1)-基础Demo实现
Raspberry pie arm version of GCC installed configuration and environment variables
Data Middle Office Construction (VII): Data Asset Management
sqlserver cannot connect remotely
How is the tree structure of the device tree reflected?
MYSQL transactions
Flutter “Hello world“ 程代码
The fledgling Xiao Li's 112th blog project notes: Wisdom cloud intelligent flower watering device actual combat (1) - basic Demo implementation
一个service层需要调用另两个service层获取数据,并组装成最后的数据,数据都是list,缓存如何设计?
带你体验一次类型编程实践
MYSQL logical architecture
OSD read SAP CRM One Order application log way of optimization
What practical projects can machine learning beginners learn?
second uncle
Basic use of vim - command mode
High dimensional Gaussian distribution basics
TCP协议详解
对无限debugger的一种处理方式
ARM 交叉编译
Solve the problem that Excel opens very slowly after installing MySQL