onLoad: function(opt) { let that = this; let n = this.data.n; function nowTime() { n++; console.log(n) if (timer) {} if (n > 5 && timer) { clearInterval(timer); } } var timer = setInterval(nowTime, 2000); },