uniapp定时器器如何关闭

在onload中设置定时器 ,发现在onhide中关闭不掉,疯狂抓狂,最后发现需要再销毁之后进行关闭

javascript 复制代码
<script>
	export default {
		data() {
			return {
				clearTime:null,
			};
		},
		onLoad(option) {
			this.clearTime=setInterval(this.hh(), 500);
		},
		onHide(){
			if(this.clearTime) {
				clearInterval(this.clearTime)
				this.clearTime=null
			}
		},
		methods: { 
			hh(){
			
			}
		},
		beforeDestroy(){
			if(this.clearTime) {
				clearInterval(this.clearTime)
				this.clearTime=null
			}
		},
	</script?
相关推荐
micro2010141 分钟前
Microsoft Edge 离线安装包制作或获取方法和下载地址分享
前端·edge
.生产的驴6 分钟前
Electron Vue框架环境搭建 Vue3环境搭建
java·前端·vue.js·spring boot·后端·electron·ecmascript
awonw9 分钟前
[前端][easyui]easyui select 默认值
前端·javascript·easyui
老齐谈电商11 分钟前
Electron桌面应用打包现有的vue项目
javascript·vue.js·electron
小雨cc5566ru20 分钟前
uniapp+Android智慧居家养老服务平台 0fjae微信小程序
android·微信小程序·uni-app
九圣残炎29 分钟前
【Vue】vue-admin-template项目搭建
前端·vue.js·arcgis
《源码好优多》42 分钟前
基于SpringBoot+Vue+Uniapp的植物园管理小程序系统(2024最新,源码+文档+远程部署+讲解视频等)
vue.js·spring boot·uni-app
柏箱1 小时前
使用JavaScript写一个网页端的四则运算器
前端·javascript·css
TU^1 小时前
C语言习题~day16
c语言·前端·算法