// 防抖
function debounce(func, delay) {
let timer = null;
return function(...args) {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
func.apply(this, args);
}, delay);
};
}
05-22
512
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-08
2579
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-04
620
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)