From f8c0e9b318d946439e9bd1584eae1fa932af6d96 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期五, 17 十一月 2023 16:32:38 +0800 Subject: [PATCH] 未生产中的完成进度显示0 因为plc 有数据 修改为可以显示数据 --- 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