From 3f798d6f31282420a4785e850278aee3c15de171 Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期二, 09 七月 2024 17:57:50 +0800 Subject: [PATCH] fix:首页样式更新 --- utils/util.js | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/utils/util.js b/utils/util.js index 7285440..465140a 100644 --- a/utils/util.js +++ b/utils/util.js @@ -13,3 +13,22 @@ return hour + ':' + minutes + ':' + seconds } } + +export const Debounce = (fn, wait) => { + let delay = wait|| 500 + let timer + return function () { + let args = arguments; + if (timer) { + clearTimeout(timer) + } + + let callNow = !timer + + timer = setTimeout(() => { + timer = null + }, delay) + + if (callNow) fn.apply(this, args) + } +} -- Gitblit v1.9.1