Vue/element中非常实用简单的 前端定时器
js中:
data: {
timer: '',
},
methods : {
//定时器:5秒
timerSetInterval:function (){
//循环定时器
//定时器循环调用的方法:getAllValue
this.timer = setInterval(this.getAllValue, 5000);
},
//销毁定时器
beforeDestroy:function() {
clearInterval(this.timer);
this.timer = '';
},
}