这是methods方法里使用到的定时器
async verScheme(index,row){
var uuid = this.getUuid();
try {
let ret = await this.$Api.OperationAccess.SystemAccess.Verification({
id: row.id,
uuid : uuid,
})
this.dialogFormVisible1 = true;
this.interval =setInterval(()=> {
this.log(uuid);
},1000);
}catch ( ret ){
this.$message.error( ret.msg ? ret.msg : "校验出错 : " + ret )
}
},
这是使用beforeDestory()
created(){
this.Init();
this.timer = this.interval;
},
beforeDestroy() {
if (this.timer) { //如果定时器还在运行 或者直接关闭,不用判断
clearInterval(this.timer); //关闭
}
},
你定时器的引用保存的不对