https://codepen.io/rahimasalman/pen/QWPJbLL
The Countdown Timer component is used to display and manage a countdown timer with customizable total time and initial time left.
totalTime(Number, default: 30): Specifies the total time for the countdown in seconds.initialTimeLeft(Number, default: 30): Specifies the initial time left for the countdown in seconds.
remainingTime: Tracks the remaining time left for the countdown.radius: Radius of the countdown timer circles.intervalId: ID of the interval used for the countdown.
circumference: Calculates the circumference of the countdown timer circles.circleStyle: Generates the CSS style for the countdown timer circles based on the remaining time.
startCountdown: Initiates the countdown by setting up an interval to decrementremainingTimeevery second until it reaches 0.clearInterval: Clears the interval used for the countdown.
initialTimeLeft: UpdatesremainingTimewheninitialTimeLeftprop changes.totalTime: AdjustsremainingTimeif the newtotalTimeis less than the currentremainingTime.
completed: Emits thecompletedevent to indicate that the countdown has finished.
To use the Countdown Timer component, include it in your Vue template and provide the totalTime and initialTimeLeft props as needed. You can start the countdown by calling the startCountdown method when necessary.
Example usage: