export function throttle(fn, wait = 3000) {
let last, timer, now
return function() {
now = Date.now()
if (last && now - last < wait) {
clearTimeout(timer)
timer = setTimeout(function() {
last = now
fn.call(this, ...arguments)
}, wait)
} else {
last = now
fn.call(this, ...arguments)
}
}
}
import { throttle } from '@/utils/throttle.js' handleSuspend: throttle(function(item) { console.log('节流') }),