From 6e377db3568788eab9bfbe2d7d7598f0ca7bca9b Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期六, 30 三月 2024 16:19:29 +0800
Subject: [PATCH] 任务详情模块确认完成和开始生产点击后自动刷新页面

---
 src/common/composable/useCountDown.ts |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/common/composable/useCountDown.ts b/src/common/composable/useCountDown.ts
index a5dfa62..4adb7d6 100644
--- a/src/common/composable/useCountDown.ts
+++ b/src/common/composable/useCountDown.ts
@@ -19,7 +19,7 @@
 }
 
 function useCountDown(seconds: number, options?: Options) {
-  const timer = new StepTimer(seconds * 1000, 1000)
+  let timer = new StepTimer(seconds * 1000, 1000)
 
   const remainingSeconds = ref<number>(seconds)
 
@@ -65,6 +65,12 @@
     timer.abort()
   }
 
+  function reset() {
+    timer.destroy()
+    remainingSeconds.value = seconds
+    timer = new StepTimer(seconds * 1000, 1000)
+  }
+
   return {
     startCountdown,
     remainingSeconds,
@@ -72,7 +78,8 @@
     continueCountdown,
     stopCountdown,
     formattedTime,
-    countdownStatus
+    countdownStatus,
+    reset
   }
 }
 

--
Gitblit v1.8.0