vue中清除定时器

// 生命周期清除
private beforeDestroy() {
// 清除定时器
console.log('清除定时器');
this.infotime = null;
this.lunxuntime = null;
clearInterval(this.infotime);
clearInterval(this.lunxuntime);
(this as any).getComponent().earlyWarningComponent.unload(); // 清除点位
// (this as any).resolveMap('map').then((event: any) => {
// (this as any).getComponent().earlyWarningComponent.unload(); // 清除点位
// });
}
// 路由守卫清除
// private beforeRouteLeave(to: any, from: any, next: any) {
// next();
// clearInterval(this.infotime);
// clearInterval(this.lunxuntime);
// this.infotime = null;
// this.lunxuntime = null;
// }

你可能感兴趣的:(vue中清除定时器)