❤ vue清除定时器Bug

❤ vue清除定时器Bug

页面加载,清除定时器 clearTimeout(intm)

问题

遇见的需求是:webapp 从A页面进入B页面,B页面点击按钮,加载完B页面的加载效果进入c,从C页面返回A页面,仍然显示B页面的加载效果

结果定时器一直无法清除在destory销毁之中。后来反复查找修改无果。多次翻看以后,突然之间发现一个问题,就是加载的页面的窗口我并没有进行隐藏,直接【_this.showTap=false】,解决掉了问题。

javascript 复制代码
timer1 = setInterval(function() {
 if (_this.numsheCount < 100) {                                         _this.numsheCount++;
if (_this.numsheCount >= 0 && _this.numsheCount < 15) {
    _this.text = '努力...';
} else if (_this.numsheCount < 20) {
	_this.text = '正在...';
	} else if (_this.numsheCount < 25) {
		_this.text = '准备分析...';
	} else if (_this.numsheCount < 50) {
		_this.text = '分析中...';
	} else if (_this.numsheCount >= 99) {
		_this.text = '久等了亲,已分析完毕!...';
		}
	} else {
		 clearInterval(timer1)
		 setTimeout(function() {
		_this.localStorage.setItem('xyuid', _this.value);
			_this.$router.push('saogao')
			_this.zhuan = false;
		}, 50)
	 }
	}, 30)
相关推荐
小江的记录本14 分钟前
【JEECG Boot】 JEECG Boot 数据字典管理——六大核心功能(内含:《JEECG Boot 数据字典开发速查清单》)
java·前端·数据库·spring boot·后端·spring·mybatis
小江的记录本14 分钟前
【JEECG Boot】 JEECG Boot——Online表单 系统性知识体系全解
java·前端·spring boot·后端·spring·低代码·mybatis
John_ToDebug14 分钟前
Chromium 页面类型与 IPC 通信机制深度解析
前端·c++·chrome
Fanfffff72016 分钟前
前端进阶:从请求竞态到并发控制(系统学习笔记)
前端·笔记·学习
大、男人16 分钟前
edge浏览器打开baidu.com很慢,我是如何解决的
前端·edge
吴声子夜歌17 分钟前
ES6——函数的扩展详解
前端·ecmascript·es6
有趣的老凌18 分钟前
一篇文章带你了解 Agent Skills —— 告别AI“失控”
前端·agent·claude
~ rainbow~21 分钟前
前端转型全栈(二)——NestJS 入门指南:从 Angular 开发者视角理解后端架构
前端·javascript·angular.js
jiayi_199922 分钟前
[bug] unsupported GNU version! gcc versions later than 12 are not supported!
服务器·bug·gnu