From e1e694369dabf557615669ce2f71e9af70277ff6 Mon Sep 17 00:00:00 2001
From: admin <344137771@qq.com>
Date: Wed, 07 Jan 2026 13:56:32 +0800
Subject: [PATCH] 1
---
src/utils/debounce.js | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/utils/debounce.js b/src/utils/debounce.js
new file mode 100644
index 0000000..60dddd4
--- /dev/null
+++ b/src/utils/debounce.js
@@ -0,0 +1,19 @@
+// 防抖 防止表单重复提交
+export const Debounce = (fn, t) => {
+ let delay = t || 300
+ 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.3