//index.js //获取应用实例 const getReq = require('./../../config.js').getReq; const app = getApp(); Page({ data: { tabs: [], special_datas:{}, summery:[] }, onLoad: function () { var self = this getReq({ act: 'index', op: 'tabs' }, function (res) { if (res.code == 200) { self.getDatas(res.datas.tabs[0].special_id); self.setData({ tabs: res.datas.tabs }); } }) }, onMyEvent: function (e) { this.setData({ special_datas: {}, summery: [] }); this.getDatas(e.detail.item.special_id) }, getDatas(special_id) { wx.showLoading({ title: '加载中' }); var self = this; getReq({ act: 'special', op: 'index', special_id, page: 10, curpage: 1 }, function (res) { if (res.code == 200) { self.setData({ special_datas: res.datas, summery:res.datas.summary }); } setTimeout(function () { wx.hideLoading() }, 1000) }) } })