refactor: ♻️ 优化系统配置和通知公告的页面
优化系统配置和通知公告的页面
This commit is contained in:
17
src/utils/commonUtil.ts
Normal file
17
src/utils/commonUtil.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 防抖函数
|
||||
* @param fn 函数
|
||||
* @param delay 延迟时间
|
||||
* @returns
|
||||
*/
|
||||
const debounce = <T extends (...args: any[]) => any>(fn: T, delay: number) => {
|
||||
let timer: number | null = null;
|
||||
return function (this: any, ...args: Parameters<T>) {
|
||||
if (timer) clearTimeout(timer);
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args);
|
||||
}, delay);
|
||||
};
|
||||
};
|
||||
|
||||
export { debounce };
|
||||
Reference in New Issue
Block a user