vue轮询接口实现

mounted() {
//轮询接口
// let that = this
// const timers = window.setInterval(() => {
// setTimeout(res =>{
// that.saveData(‘1’)
// },0)//利用定时器清除setInterval的每次叠加
// }, 600000);//10分钟执行一次
// //使用 o n c e 在 离 开 当 前 路 由 时 销 毁 定 时 器 / / t h i s . once在离开当前路由时销毁定时器 // this. once//this.once(‘hook:beforeDestroy’,()=>{
// clearInterval(timers);
// })
},
// 在vue实例销毁前调用(类似跳转路由调用)
// beforeDestroy(){}
喜欢作者点歌赞吧,谢谢大家

猜你喜欢

转载自blog.csdn.net/HDhanmingyang/article/details/103612065