分类页面分为4个文件,详情说明如下:
1、shops.js 接口数据交互
var app = getApp();
Page({
data: {
cateItems: [],
curNav: 1,
curIndex: 0,
second_height: 0,
openid: '',
},
onLoad: function (options) {
app.pageConfig(this);
app.util.footer(this);
var that = this;
var openid = wx.getStorageSync('openid');
if (options.cid) {
this.setData({
openid: openid,
curNav: options.cid,
curIndex: options.in,
})
this.GetCategory(1);
} else {
this.setData({
openid: openid,
})
this.GetCategory(0);
}
},
onShow: function () {
var that = this;
wx.getSystemInfo({
success: function (res) {
// 计算主体部分高度,单位为px
that.setData({
second_height: res.windowHeight
})
}
})
},
//事件处理函数
switchRightTab: functio