search

Home  >  Q&A  >  body text

javascript - How to write countdown in WeChat applet

How to write a countdown in WeChat applet? Ask God for help

我想大声告诉你我想大声告诉你2780 days ago911

reply all(4)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-06-05 11:12:54

    SetTimeout

    reply
    0
  • 黄舟

    黄舟2017-06-05 11:12:54

    The displayed content is bound to a variable
    SetTimeOut executes a function regularly
    Use setData in this function to change the bound variable

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-06-05 11:12:54

    Countdown effect? Shouldn’t it be setInterval

    reply
    0
  • 黄舟

    黄舟2017-06-05 11:12:54

    If you don’t want to write code, tell me your ideas! Write a method whose parameter is the number of seconds for the countdown. For simplicity, pass another object, which is this of the current page. Make an if and else judgment. If the parameter is equal to 0, it will end and do related operations. If it is not equal to 0, do some related operations, such as After setting this.setdata and decrementing the parameters passed in, setimeout continues to call this function!

    reply
    0
  • Cancelreply