微信小程序使用clearInterval清除定时函数无效?

发布于 6 年前作者 minghao2341 次浏览最后编辑 6 年前来自 issues

电脑调试没有问题,真机调试clearInterval无效。定时器还会继续跑

4 回复
yefang
yefang1 楼6 年前

上代码片段

baiyong
baiyong2 楼6 年前

调用clearInterval()之后,试试把句柄置为null

设置interval的地方:
let interval = setInterval(fun,xxx)
that.interval = interval

clearInterval的地方:
clearInterval(that.interval)
that.interval = null

 

qiangcao
qiangcao3 楼6 年前

不上代码片段 我都当是自己的问题。

ming67
ming674 楼4 年前

打开调试,有报错吗