How to write a countdown in WeChat applet? Ask God for help
黄舟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
黄舟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!