1. // 倒计时
2. function countTime(that, e) {
3. if (e == 0) {
4. that.setData({
5. isGetCode: true
6. })
7. return
8. }
9. e--
10. that.setData({
11. count: e
12. })
13. setTimeout(()=>{
14. countTime(that, e)
15. },1000)
16. }
使用:
1. countTime(this, 60)