2024-05-22 防抖 防抖函数 func是用户传入需要防抖的函数 wait是等待时间 1234567891011function debounce(func, wait = 50) { let timer = 0; return function (...args) { if (timer) clearTimeout(timer); timer = setTimeout(() => { timer = setTimeout(() => { func.apply(this, args) }, wait) }) }} 后一篇 节流