애플릿은 위로 당기고 더 많이 불러오기를 실현한다
1919 단어 애플릿
const app = getApp();
Page({
data: {
movieList: [],
page: 1// ,
},
onLoad() {
var that = this;
this.getMore(that.data.page);
},
onReachBottom: function() {
console.log(1);
swan.showLoading({
title: ' ',
make: true
})
var that = this;
this. getMore(that.data.page);
},
getMore: function (page) {
var that = this;
if (page == 1) {
swan.showLoading({
title: ' ',
make: true
})
}
swan.request({
url: 'https://mip.yesky.com/fishVideo/video/movieList.json',
method: 'GET',
data: {
pageNo: page
},
header: {
'content-type': 'application/json'
},
success: function (res) {
var res = res.data.movieList;
if (that.data.page > 1) {
var movieLists = that.data.movieList;
console.log(movieLists);
that.setData({
movieList: movieLists.concat(res),
page: page + 1
})
} else {
that.setData({
movieList: res,
page: page + 1
})
}
}, fail: function () {
swan.showToast({
title: ' ',
duration: 1500
})
},
complete: function () {
if (page >= 1) {
swan.hideLoading()
}
}
})
}
})