防抖
2021-09-07 本文已影响0人
帆_44fc
timeout: null,
count: 0
fn(name) {
if (this.count == 0) {
this.count++;// 第一次点执行
// console.log(this.count,'count')
this.handleSubmit1(name);
} else {
if (this.timeout) {
clearTimeout(this.timeout);
}
this.timeout = setTimeout(() => {
this.handleSubmit1(name);
// console.log('222');
}, 500);
}
},