这里是启用定时器。this.getlist是我调用的下面自己封装的接口
created() {
this.timer
=setInterval(() => {
this.getList();
this.getListmiddle();
this.getListlast();
console
.log(111);
}, 500);
},
var foo
= 'bar';
下面是清除定时器
beforeDestroy() {
if (this.timer
) {
console
.log("销毁定时器")
clearInterval(this.timer
);
}
}
var foo
= 'bar';
转载请注明原文地址:https://tech.qufami.com/read-23233.html