el-input 双向绑定失效

<el-input v-model="ruleForm.textX" οninput="value=value.replace(/[^\d,]/g,'')" ></el-input>

项目需要只能输入数字,所有使用oninput+正则来限制用户输入,但是在使用中文输入法输入按shift切换到英文输入法时,再输入的数字会获取不到,这个时候发现双向绑定失效,所以需要重新赋值,改成以下代码可以实现

<el-input v-model="ruleForm.textX" οninput="value=value.replace(/[^\d,]/g,'')" @blur="ruleForm.textX = $event.target.value" ></el-input>

相关推荐
摘星编程40 分钟前
React Native for OpenHarmony 实战:Linking 链接处理详解
javascript·react native·react.js
胖者是谁1 小时前
EasyPlayerPro的使用方法
前端·javascript·css
EndingCoder1 小时前
索引类型和 keyof 操作符
linux·运维·前端·javascript·ubuntu·typescript
摘星编程2 小时前
React Native for OpenHarmony 实战:ImageBackground 背景图片详解
javascript·react native·react.js
摘星编程3 小时前
React Native for OpenHarmony 实战:Alert 警告提示详解
javascript·react native·react.js
Joe5563 小时前
vue2 + antDesign 下拉框限制只能选择2个
服务器·前端·javascript
WHS-_-20223 小时前
Tx and Rx IQ Imbalance Compensation for JCAS in 5G NR
javascript·算法·5g
摘星编程3 小时前
React Native for OpenHarmony 实战:GestureResponderSystem 手势系统详解
javascript·react native·react.js
lili-felicity3 小时前
React Native for OpenHarmony 实战:加载效果的实现详解
javascript·react native·react.js·harmonyos
济6174 小时前
linux 系统移植(第六期)--Uboot移植(5)--bootcmd 和 bootargs 环境变量-- Ubuntu20.04
java·前端·javascript