uniapp定时器器如何关闭

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

<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?

你可能感兴趣的:(uni-app,前端,javascript)