Countdown to e-commerce seckilling in applets

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.