微信小程序-翻页

Posted 魏文塔

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了微信小程序-翻页相关的知识,希望对你有一定的参考价值。

function cardInfo( flag, currentPage,that){
wx.showLoading({
title: ‘加载中‘,
});
wx.request({
url: ‘https://www.lenfshion.com/projectmng/appuser/exchangelist‘,
method: "POST",
data: {
apptoken: wx.getStorageSync("token"),
flag: flag,
currentPage: currentPage
},
header: {
‘content-type‘: ‘application/json‘
},
success: function (res) {
// console.log(res.data);
wx.hideLoading();
if(res.data.result=="01"){
cardlength = res.data.list.length;
if (currentPage==1){
var cardList = res.data.list;
for (var i = 0; i < cardlength; i++) {
faceImg = imgUrl + cardList[i].face;
cardList[i].face = faceImg;
}
// 赋值
if (cardlength == 0) {
if (that.data.currentTab == 0) {
that.setData({
cardList: cardList,
numberdisplay: false,
})
state1 = false;
} else if (that.data.currentTab == 1) {
that.setData({
exchangeList: cardList,
changeDisplay: false,
})
state2 = false;
} else {
that.setData({
CollectionList: cardList,
callDisplay: false,
})
state3 = false;
}
} else {
if (that.data.currentTab == 0) {
that.setData({
cardList: cardList,
numberdisplay: true,
})
state1 = false;
} else if (that.data.currentTab == 1) {
that.setData({
exchangeList: cardList,
changeDisplay: true,
})
state2 = false;
} else {
that.setData({
CollectionList: cardList,
callDisplay: true,
})
state3 = false;
}
}
}else{
if (cardlength == "0") {
return
}
var cardMore = ‘‘;
var cardList = res.data.list
for (var i = 0; i < cardlength; i++) {
faceImg = imgUrl + cardList[i].face;
cardList[i].face = faceImg;
var arr = that.data.cardList;
arr.push(res.data.list[i]);
cardMore = arr;
}
// 加载更多
if (that.data.currentTab==0){
that.setData({
cardList: cardMore,
numberdisplay: true
})
} else if (that.data.currentTab == 1){
that.setData({
exchangeList: cardMore,
changeDisplay: true
})
}else{
that.setData({
CollectionList: cardMore,
callDisplay: true
})
}
}
}else{
getApp().maskInfos(res.data.result, res.data.msg);
}
}
});
}

以上是关于微信小程序-翻页的主要内容,如果未能解决你的问题,请参考以下文章

微信小程序直播消息滑动

ios微信小程序上下滑动效果

微信小程序开发中如何实现侧边栏的滑动效果

微信小程序上拉加载:onReachBottom详解+设置触发距离

微信文档怎么分页视图

微信小程序是啥?微信小程序有啥用?