当前位置:网站首页>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
边栏推荐
- MYSQL two-phase commit
- sqlserver cannot connect remotely
- The bigger and bigger the project is, I split it like this
- You need to know the TCP wave four times
- 【搜索专题】看完必会的BFS解决最短路问题攻略
- 机器学习初学者可以学哪些实战项目?
- MYSQL Index Analysis
- pdb drug comprehensive database
- 2022 CSP-J1 CSP-S1 Round 1 Preliminary Competition Registration Guide
- 手写二叉查找树及测试
猜你喜欢
![leetcode: 1562. Find latest grouping of size M [simulation + endpoint record + range merge]](/img/72/f52b5d3dcdb271f096c3e5108f0042.png)
leetcode: 1562. Find latest grouping of size M [simulation + endpoint record + range merge]

对无限debugger的一种处理方式

MYSQL two-phase commit
![ROS2 series of knowledge (4): understand the concept of [service]](/img/14/8de92a89d9c4b6476ac37408bc7788.png)
ROS2 series of knowledge (4): understand the concept of [service]

HCIP (14)
![[Data analysis] Based on matlab GUI student achievement management system [including Matlab source code 1981]](/img/65/b84443b98c28d2728e9ae44b1294fb.jpg)
[Data analysis] Based on matlab GUI student achievement management system [including Matlab source code 1981]

如何下载Keil包

SC7A20 (Silan Micro-Accelerometer) Example

这个地图绘制工具太赞了,推荐~~

更换树莓派内核
随机推荐
By Value or By Reference
How is the tree structure of the device tree reflected?
设备树的树形结构到底是怎样体现的?
RTL8762DK UART (two)
2022 CSP-J1 CSP-S1 Round 1 Preliminary Competition Registration Guide
HCIP(14)
链式编程、包、访问权限
Dart 命名参数语法
MySQL修改SQL语句优化性能
Detailed explanation of TCP protocol
数据中台建设(七):数据资产管理
Four ways the Metaverse is changing the way humans work
如何下载Keil包
Guys, MySQL cdc source recycles replication slave and r in incremental process
MYSQL Keyword Explain Analysis
leetcode6132. 使数组中所有元素都等于零(简单,周赛)
ARM 交叉编译
IDEA调试
初出茅庐的小李第114篇博客项目笔记之机智云智能浇花器实战(3)-基础Demo实现
785. Quick Sort