|
@ -23,17 +23,17 @@ function noMultipleClicks(methods, info) { |
|
|
|
|
|
|
|
|
// 节流函数
|
|
|
// 节流函数
|
|
|
const throttle = (fn, t,_this) => { |
|
|
const throttle = (fn, t,_this) => { |
|
|
console.log('throttle') |
|
|
console.log('throttle') |
|
|
return ()=> { |
|
|
return ()=> { |
|
|
if (!_this.timer) { |
|
|
if (!_this.timer) { |
|
|
_this.timer = setTimeout(()=>{ |
|
|
_this.timer = setTimeout(()=>{ |
|
|
fn() |
|
|
console.log('fn') |
|
|
console.log('fn') |
|
|
//·清空定时器
|
|
|
//·清空定时器
|
|
|
_this.timer = null |
|
|
_this.timer = null |
|
|
}, t) |
|
|
}, t) |
|
|
fn() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|