1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- // 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();
-
-
- }
-
- })
|