1.方法1
定义一个定时器:
private timeOutId:number = 1;
this.timeOutId = setTimer(()=>{
}, 2000)
例子:
当页面消失时销毁一个定时器:
aboutToDisappear(){
clearTimeout(this.timeOutId)
this.timeOutId = -1;
}
例子:
2.方法2
TimeController :TextTimerController = new TextTimerController ()
TextTimer({ isCountDown:true, count:3000, controller:this.TimerController}).fontSize(35).format("mm:ss.SS")
下面处理定时器结束重置状态方法