2023西安数博会CIM演示-【前端】-Web
AdaKing88
2023-08-21 bc03b832caa49bbcd2674fe4cae3701b5059bf95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
let timer = null
export default function debounce(fn, time, arg) {
  let first = !timer
 
  if (timer){
    clearTimeout(timer)
  }
 
  timer = setTimeout(() => {
    timer = null
  }, time);
 
  if (first) {
    fn(arg)
  } 
 
}