- 小程序开发者工具为什么狂吃cpu内存? 动不动就崩溃了。
[图片]
2019-11-19 - 我怎么样才能在页面加载完成后调用我的定时器?
为什么使用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[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码]})[代码]
2019-08-28