❤ vue clear timer bug

❤ vue clear timer bug

Page load, clear timer clearTimeout(intm)

question

The demand met is: webapp enters page B from page A, clicks the button on page B, after loading the loading effect of page B, enters c, returns to page A from page C, and still displays the loading effect of page B

As a result, the timer has been unable to be cleared during the destruction. Later, I searched and modified repeatedly to no avail. After looking through it many times, I suddenly found a problem, that is, I did not hide the window of the loaded page, and directly [_this.showTap=false] solved the problem.

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)

 

Guess you like

Origin blog.csdn.net/weixin_43615570/article/details/131009879