html部分
<el-input placeholder="请输入内容" v-model="searchinput" clearable class="input-with-select" @input="getchange">
js部分
data(){
return{
starttime: null
}
},
methods:{
getchange(val) {
this.starttime = event.timeStamp;
let _this=this;
let e = event;
setTimeout(function() {
if (_this.starttime - e.timeStamp == 0) {
//你的操作....
}
},1000)
}
}
或
getchange(val) {
console.log(val)
clearTimeout(this.timeryz)// 清除之前的定时器
// 1.5秒后后执行
this.timeryz = setTimeout(() => {// 重新设置定时器
console.log("接口")
}, 1500);
}