vue 单独页面定时器 离开页面销毁定时器
2024-08-28 21:25:43
data: {
return {
timer: null
}
},
created() {
this.timer = setInterval(....);
},
beforeDestroy() {
if(this.timer) { //如果定时器还在运行 或者直接关闭,不用判断
clearInterval(this.timer); //关闭
}
}
最新文章
- 高德地图API 简单使用
- nodemailer 发邮件
- asp.net form身份认证不定时认证失败的问题 排查
- html中隐藏域hidden的作用介绍及使用示例
- The ShortCuts in the ADT (to be continued)
- Resource Manager
- POJ 1160 Post Office
- OpenCV基础篇之画图及RNG随机数对象
- js原型链部分详细使用说明案例
- Android 创建虚拟机时“提示no system images installed for this target”
- Linux基础五
- Python中模块之re的功能介绍
- 学习tornado:异步
- 深度学习python的配置(Windows)
- Oracle安装配置
- 【树上莫队】【SP10707】 COT2 - Count on a tree II
- LR通用的性能分析流程
- Linux-数据库1
- 微信图片反防盗链 用js不太成熟的解决方式 仅供参考
- How to simplify a PHP code with the help of the façade pattern?