common.js 196 B

12345678
  1. // 防抖函数
  2. export function debounce(func, wait) {
  3. let timeout;
  4. return function (...args) {
  5. clearTimeout(timeout);
  6. timeout = setTimeout(() => func.apply(this, args), wait);
  7. };
  8. }