// 防抖
debounceAjax = (fun, delay) => {
return (value) => {
clearTimeout(fun?.time)
fun.time = setTimeout(() => {
fun(value);
}, delay)
}
}
this.debounceAjax(this.ajax, 500)(value);
防抖的实现方式有很多,但这么简介的你见过吗?
// 防抖
debounceAjax = (fun, delay) => {
return (value) => {
clearTimeout(fun?.time)
fun.time = setTimeout(() => {
fun(value);
}, delay)
}
}
this.debounceAjax(this.ajax, 500)(value);
防抖的实现方式有很多,但这么简介的你见过吗?