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 |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/utils/util.js b/utils/util.js
index f5e9768..465140a 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -1,7 +1,34 @@
-export function todayDate(){
+export function todayDate(arg) {
 	let date = new Date()
 	let year = date.getFullYear()
 	let month = date.getMonth() + 1;
 	let day = date.getDate()
-	return year + '-' + month + '-' + day
-}
\ No newline at end of file
+	let hour = date.getHours()
+	let minutes = date.getMinutes()
+	let seconds = date.getSeconds()
+	if (arg == 'hms') {
+		hour = hour < 10 ? '0' + hour : hour
+		minutes = minutes < 10 ? '0' + minutes : minutes
+		seconds = seconds < 10 ? '0' + seconds : seconds
+		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