// pages/index/index.js var app = getApp() Page({ /** * 页面的初始数据 */ data: { goods:[], cid:0, id:0, imgurl: app.data.resturl }, getGoodsList: function(){ var that = this; let cid = this.data.cid; let id = this.data.id; wx.request({ url: app.data.resturl + '/tjlist.action', data: { cid:cid, id:id }, success:function(res){ that.setData({ goods: res.data.dlist }) setTimeout(()=>{ wx.hideLoading() },500) } }) }, tabDetails(e){ wx.navigateTo({ url: '/pages/goods-details/index?id='+e.currentTarget.dataset.id }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let cid = options.cid; this.setData({ cid:cid, id:options.id }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { var that = this; that.getGoodsList(); } })