export function debounce(func, delay) { let timer; return function (...args) { if (timer) { clearTimeout(timer) } timer = setTimeout(() => { func.apply(this, args) }, delay) }}
本文共 262 字,大约阅读时间需要 1 分钟。
export function debounce(func, delay) { let timer; return function (...args) { if (timer) { clearTimeout(timer) } timer = setTimeout(() => { func.apply(this, args) }, delay) }}
转载于:https://www.cnblogs.com/ilovexiaoming/p/11128690.html