From 5e08d4f61c24db589bd6d30875fcb1191f719b16 Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期五, 11 四月 2025 20:41:44 +0800 Subject: [PATCH] feat:申请复磅 --- 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