节流函数——在 limit 毫秒内最多执行一次
limit
待节流的原始函数
节流间隔毫秒数
经过节流封装的函数,与 fn 具有相同入参
const handleScroll = throttle(() => updateHeader(), 100) Copy
const handleScroll = throttle(() => updateHeader(), 100)
节流函数——在
limit毫秒内最多执行一次