Flash sales are often used in e-commerce applications, so the flash sales will have a countdown function. here we will use the countdown function shown last time to e-commerce applications. Flash sales are often used in e-commerce applications, so the flash sales will have a countdown function. here we will use the countdown function shown last time to e-commerce applications.
Basic functions
1. countdown to flash sales for mini-app-like e-commerce websites
2. the display format is: 1 day 11 hours 11 minutes 11 seconds 11
3. after the second kill time is over, the system prompts that the second kill is over.
First Look
Actually, implementation is quite simple.
Seckilling: {clock }}
{Micro_second }}
Below is the js implementation code
// Indes. js/*** requires a target date. during initialization, the number of seconds remaining until the current time is exceeded * 1. convert the number of seconds into formatted output format: XX days, XX hours, XX minutes, XX seconds, XX * 2. provides a clock that runs every 10 ms, rendering the clock, and then auto-minus 10*3 in the total number of ms. the remaining seconds are zero, return, and tips prompts that a total number of milliseconds has been defined as of * //. take one day as an example. // var total_micro_second = 3600*1000*24; // This is a one-day countdown var total_micro_second = 10*1000; // This is a 10-second countdown/* millisecond-level seckilling countdown */function countdown (that) {// rendering countdown clock that. setData ({clock: dateformat (total_micro_second) // format Time}); if (total_micro_second <= 0) {that. setData ({clock: "The second kill is over"}); // timeout jumps out of recursive return ;}
For more articles on how to implement the countdown of e-commerce flash sales in small programs, please pay attention to PHP Chinese network!