|
|
|
export const Debounce = (func, delay) => {
|
|
let timer;
|
|
|
|
return function() {
|
|
const context = this;
|
|
const args = arguments;
|
|
clearTimeout(timer);
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
timer = setTimeout(() => {
|
|
func.apply(context, args);
|
|
uni.hideLoading()
|
|
}, delay);
|
|
};
|
|
} |