问题描述:客户列表点击进入详情页,有时候有数据,有时候没有数据。
代码:
onLoad: function (options) { // 页面初始化 options为页面跳转所带来的参数 console.log(options); if (options.id != '' && options.id != undefined) { this.setData({ id: options.id }) } }, onReady: function () { // 页面渲染完成 }, onShow: function () { // 页面显示 this.getCclass() this.customerVisit() },
原因:
this.getCclass()与函数 this.customerVisit()中都有数据请求,小程序不是同步执行,两者又有依赖关系,后面改成在this.getCclass请求成功的success条用 this.customerVisit()就没问题了