欢迎光临,了解微信小程序开发,就上易用通!

小程序的坑

发布:2018-02-02 10:29浏览: 来源:网络 作者:cola

问题描述:客户列表点击进入详情页,有时候有数据,有时候没有数据。

小程序的坑(图1)小程序的坑(图2)

代码:

 

				
  1. [javascript] view plain copy print?在CODE上查看代码片派生到我的代码片
  2. onLoad: function (options) {
  3. // 页面初始化 options为页面跳转所带来的参数
  4. console.log(options);
  5. if (options.id != '' && options.id != undefined) {
  6. this.setData({
  7. id: options.id
  8. })
  9. }
  10. },
  11. onReady: function () {
  12. // 页面渲染完成
  13. },
  14. onShow: function () {
  15. // 页面显示
  16. this.getCclass()
  17. this.customerVisit()
  18. },

原因:

 

				
  1. [plain] view plain copy print?在CODE上查看代码片派生到我的代码片
  2. this.getCclass()与函数
  3.  
  4. this.customerVisit()
  5.  
  6. 中都有数据请求,小程序不是同步执行,两者又有依赖关系,
  7. 后面改成在
  8.  
  9. this.getCclass请求成功的success条用
  10.  
  11. this.customerVisit()

就没问题了






免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。