我怎么样才能在页面加载完成后调用我的定时器?
为什么使用navigator 页面跳转 不会跳转?
//index.js//获取应用实例const app = getApp()Page({ data: { num:2, win:'你赢了', imgUrl:[ "/images/quan_03.png", "/images/quan_05.png", "/images/quan_07.png", ], winNum:0, myTime:'' }, //事件处理函数 bindViewTap: function() { wx.navigateTo({ url: '../logs/logs' }) }, onLoad: function () { }, mySetinterval(){ this.data.myTime = setInterval(()=>{ let n = Math.floor(Math.random() * 3) console.log(123) this.setData({ num: n }, 2000); },1000) }, endtime(){ clearInterval(this.myTime) }, onReady(){ }, getUserInfo: function(e) { console.log(e) app.globalData.userInfo = e.detail.userInfo this.setData({ userInfo: e.detail.userInfo, hasUserInfo: true }) }}) |
