javascript - How to write countdown in WeChat applet
我想大声告诉你
我想大声告诉你 2017-06-05 11:10:54
0
4
831

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

我想大声告诉你
我想大声告诉你

reply all(4)
给我你的怀抱

SetTimeout

黄舟

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

淡淡烟草味

Countdown effect? Shouldn’t it be setInterval

黄舟

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!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!