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!
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!