el-input监听不到失焦事件
时间: 2023-08-15 08:15:31 浏览: 839
el-input监听不到失焦事件的解决方案是通过获取el-input-number实例,然后获取input组件实例去执行失去焦点blur事件。具体代码如下:
this.$refs.elInputNumber.$refs.input.blur()。\[2\]另外,如果需要实时监听输入数字的变化,可以将@change替换成@input.native,并在eventDisposalRangeChange方法中获取输入框的实时值,并重新赋值给绑定的对象。具体代码如下:
eventDisposalRangeChange(value) {
const key = this.$refs.refNumber.displayValue;
this.ruleForm.num = key;
if (value != undefined) {
this.$refs.ruleForm.clearValidate("num");
}
} \[3\]这样就可以实现对输入框的实时监听了。
#### 引用[.reference_title]
- *1* *2* [el-input-number 失去焦点blur事件,](https://blog.csdn.net/qq_52125118/article/details/130085867)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Element系列之el-input-number无法实时监听数据变化的解决方法](https://blog.csdn.net/weixin_62277266/article/details/124812768)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文