初始定义个timer
private timer: any = null
//刷新方法 然后再mounted调用就可
private getDataTimer() {
this.timer = setInterval(() => {
//这里放需要循环刷新的方法
// this.getWatchData()
//this.getData()
}, 10000)
}
//页面失活时
deactivated() {
clearInterval(this.timer)
this.timer = null
}
定时刷新功能
最新推荐文章于 2024-06-16 18:09:06 发布