Do not use the @input event of EL-input, use this event, use buffering does not work. The actual code is as follows:
<template>
<el-input suffix-icon="el-icon-search" v-model="page.searchCode" clearable></el-input>
</template>
<script>
data() {
return {
timer: '',
page:{
searchCode:''
}
}
},
watch: {
'page.searchCode': {
deep: true,
handler(newVal, oldVal) {
// if (newVal.trim().length !== 0) {
//this.getList is a method called after a delay of 500ms.
this.debounce(this.getList, 500)
// }
}
}
},
methods: {
debounce(fn, wait) {
if (this.timer !== null) {
clearTimeout(this.timer)
}
this.timer = setTimeout(fn, wait)
}
},
getList(){}//The request can be written in here.
}
</script>
Read More:
- How to restrict input field to only input pure numbers in HTML
- How to increase the effect of onchange event after adding readonly attribute to input tag and display time of laydate plug-in
- The problem that the El icons icon cannot be displayed in vue3 + element plus + vite
- Android monitor EditText text input EditText monitor events and input events
- [Solved] VUE3.0 Warning: Added non-passive event listener to a scroll-blocking ‘mousewheel‘ event如何解决
- Assertion `input_val >= zero && input_val <= one` failed
- Xshell frequently disconnects, indicating socket error event: 32 error: 10053 connection failure
- Elmentui form. When setting input type = number, remove the up and down arrows
- Ubuntu 16.04 install Chinese input method
- The solution to the sudden change of win10 input method into traditional Chinese
- Solution to sudden change of win10 input method into traditional Chinese
- [Solved] Failed to set attribute: Invalid input data or parameter
- iOS Failed to find matching arch for 64-bit Mach-O input file
- To solve the problem of repeated password input when operating sourcetree on MAC
- “Input button submit is not setup” solution
- Matlab: successfully solve too many input arguments
- Matlab prompts undefined operator ‘*’ for input arguments of type ‘cell’
- When configuring the proxy with Vue, the front-end requests the server-side error 504; the Vue console reports the error occurred while trying to proxy request
- Typeerror: UFUNC ‘isn’t supported for the input types
- java.nio.charset.MalformedInputException: Input length = 1