<template>
<div class="countdown-box">
<span>{
{
formatTime }}</span>
</div>
</template>
<script lang="ts" setup>
import {
ref, onMounted, onBeforeUnmount, watch } from 'vue';
let formatTime = ref('');
const props = defineProps({
totalTime: Number,
interval: {
type: Number,
default: 1000
},
})
watch(() => props.totalTime, (newVal, oldVal) => {
totalTime = newVal;
stopCountDown()
startCountDown()
})
const secondToTimeStr = (t: number, type: any) => {
let timeStr1 = '', timeStr2 = '', timeStr3 = '';
if (type == 0)