- 关于code2Session 获取unionid的问题
调用接口之后发现返回只有openid,是不是要这样理解,只有用户在之前 统一账户下的其他小程序~公众号授权之后,新的小程序公众号才会通过code2Session返回unionid呢?
2018-09-19 - 官方大大看看这个是机制还bug啊
https://developers.weixin.qq.com/community/develop/doc/0006c4dc1d46a0fb9527bc58857000
2018-08-20 - navigateTo的成功回调函数,先于跳转页面Onload执行还是之后执行
https://developers.weixin.qq.com/blogdetail?action=get_post_info&lang=zh_CN&token=792543524&docid=0006c4dc1d46a0fb9527bc58857000 我个人觉得应该要先于onload之前执行吧,先执行success,再执行页面的onload吧,大家是怎样看的
2018-08-17 - navigateTo跳转的页面Onload先与组件的success回调触发
各位前辈好,我个人理解的navigateTo的成功后回调应该是先运行回调,再跳转页面,在真机使用中(开发工具正常)发生了navigateTo跳转的页面Onload先与组件的success回调触发 我本是想跳转成功会改变全局变量,跳转的页面在onload里面再使用这个全局变量的 [图片] [图片] [图片]
2018-08-04 - 大家遇见过这个情况吗?navigateTo跳转的页面Onload先触发
navigateTo 在真机测试中 success回调函数会慢于所跳转的页面的onload触发 这是为啥呢 要怎么避免呢
2018-08-03 - 报错 Error: Expected updated data but...
小程序报错 [代码]Expected updated data but get first rendering data;Expected updated data but get first rendering data[代码] [代码]Error: Expected updated data but get first rendering data[代码] 在开发工具上会二次渲染,但是在手机上就不能了,而且这个报错是时有时无的,求大神分享一下报错的原因,该如何排查呢 在网上也有人遇见同样的问题了 解决方案:在app.js中还没有给globalData赋值时却提前跳转到了调用globalData数据的页面,所以导致渲染失败,个人建议做个引导或加载页面,给数据一个缓冲的过程; 我在App.js里的代码 [代码]App({[代码][代码] [代码][代码]onLaunch: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]this[代码] [代码].getOpenid().then(()=>{[代码][代码] [代码][代码]return[代码] [代码]that.setAdmin()[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]getOpenid: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码] [代码][代码]return[代码] [代码]new[代码] [代码]Promise( [代码][代码]function[代码] [代码](resolve, reject) {[代码][代码] [代码][代码]wx.getStorage({[代码][代码] [代码][代码]key: [代码][代码]'openid'[代码] [代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]that.globalData.openId = res.data[代码][代码] [代码][代码]return[代码] [代码]resolve( [代码][代码]'app.js login success'[代码] [代码])[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]wx.login({[代码][代码] [代码][代码]success: res => {[代码][代码] [代码][代码]var[代码] [代码]code = res.code; [代码][代码]//返回code[代码][代码] [代码][代码]var[代码] [代码]appId = [代码][代码] [代码][代码]var[代码] [代码]secret = [代码][代码] [代码][代码]wx.request({[代码][代码] [代码][代码]url: [代码][代码]'https://api.weixin.qq.com/sns/jscode2session?appid='[代码] [代码]+ appId + [代码][代码]'&secret='[代码] [代码]+ secret + [代码][代码]'&js_code='[代码] [代码]+ code + [代码][代码]'&grant_type=authorization_code'[代码] [代码],[代码][代码] [代码][代码]data: {},[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]'content-type'[代码] [代码]: [代码][代码]'json'[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]wx.setStorage({[代码][代码] [代码][代码]key: [代码][代码]"openid"[代码] [代码],[代码][代码] [代码][代码]data: res.data.openid[代码][代码] [代码][代码]})[代码][代码] [代码][代码]that.globalData.openId = res.data.openid[代码][代码] [代码][代码]return[代码] [代码]resolve( [代码][代码]'app.js login success'[代码] [代码])[代码][代码] [代码] [代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]setAdmin: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码] [代码][代码]return[代码] [代码]new[代码] [代码]Promise( [代码][代码]function[代码] [代码](resolve, reject) {[代码][代码] [代码][代码]wx.request({[代码][代码] [代码][代码]url: [代码][代码]'http://132.232.22.140:8889/api/club/adminComfirm'[代码] [代码],[代码][代码] [代码][代码]method: [代码][代码]'post'[代码] [代码],[代码][代码] [代码][代码]data:{[代码][代码] [代码][代码]id:that.globalData.openId[代码][代码] [代码][代码]},[代码][代码] [代码][代码]header:{[代码][代码] [代码][代码]"content-type"[代码] [代码]: [代码][代码]'application/json'[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res){[代码][代码] [代码][代码]if[代码] [代码](res.data.code ==300){[代码][代码] [代码][代码]wx.reLaunch({[代码][代码] [代码][代码]url: [代码][代码]'../../pages/findpage/index'[代码] [代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]if[代码] [代码](res.data.code == 200){[代码][代码] [代码][代码]that.globalData.myclub = res.data.clubnumber[代码][代码] [代码][代码]that.globalData.myname = res.data.name[代码][代码] [代码][代码]that.globalData.adminOn = [代码][代码]true[代码][代码] [代码][代码]wx.reLaunch({[代码][代码] [代码][代码]url: [代码][代码]'../../pages/index/index'[代码] [代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]globalData: {[代码][代码] [代码][代码]userInfo: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]openId: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]myclub: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]myname: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]adminOn: [代码][代码]false[代码] [代码],[代码][代码] [代码][代码]findClub: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]findClubNumber: [代码][代码]null[代码][代码] [代码][代码]}[代码][代码]})[代码]因为之前就遇见过页面初始化完成之后没有得到数据,所以我在首页设置的是一个空页面 app.json [代码]"pages" [代码][代码]: [[代码][代码] [代码][代码]"pages/midware/index" [代码][代码],[代码][代码] [代码][代码]"pages/index/index" [代码][代码],[代码][代码] [代码][代码]"pages/findpage/index" [代码][代码],[代码][代码] [代码][代码]"pages/signup/index" [代码][代码],[代码][代码] [代码][代码]"pages/join/index" [代码][代码],[代码][代码] [代码][代码]"pages/option/index" [代码][代码],[代码][代码] [代码][代码]"pages/details/index" [代码][代码],[代码][代码] [代码][代码]"pages/setting/index" [代码][代码],[代码][代码] [代码][代码]"pages/memo/index"[代码][代码] [代码][代码]],[代码]第一个就是空页面,然后主页面的选择在上面App.js里面来判断的,按道理来说,在页面初始化过程中除了对globalData进行赋值之外没有任何取值的操作呀
2018-08-01 - 报错 Error: Expected updated data but...
小程序报错 [代码]Expected updated data but get first rendering data;Expected updated data but get first rendering data[代码] [代码]Error: Expected updated data but get first rendering data[代码] 在开发工具上会二次渲染,但是在手机上就不能了,而且这个报错是时有时无的,求大神分享一下报错的原因,该如何排查呢
2018-07-30