unionapp刷新页面代码,method中加方法
refreshPage() {
uni.reLaunch({
url:"页面路径"
})
},
此时刷新后发现定时器还在不停执行,解决办法为在刷新前将定时器清除:
data() {
return {
//定义定时器状态变量
timer:null,
}
},
方法中使用定时器时:
this.timer = setInterval(function() {
//一些操作
},1000);
调整刷新方法:
refreshPage() {
clearInterval(this.timer);
this.timer = null;
uni.reLaunch({
url:"/pages/filecheck/fileStateCheck"
})
},
问题解决