榆山数据端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

70 lines
1.6 KiB

Page({
data: {
pageSize: 10,
pageIndex: 1,
listLength: 0,
loadVisible: true,
loadType: 'more',
isShow: false,
newList: [],
preloadVisible: true,
selectTab: 'tab1',
pagename: 'solveProject'
},
onShow: function () {
this.selectComponent("#" + this.data.selectTab).getUnpassedList(this.data)
},
onGetCode: function (e: { detail: { val: any } }) {
this.setData({
preloadVisible: e.detail.preloadVisible,
listLength: e.detail.listLength,
loadType: e.detail.loadType
})
if (this.data.pageIndex == 1) {
if (e.detail.listLength == 0) {
this.setData({
loadVisible: false,
isShow: true
})
}
}
},
// tab 切换
onTabChange(e: AnyObject) {
wx.pageScrollTo({
scrollTop: 0,
duration: 300
})
this.setData({
newList:[],
selectTab: e.currentTarget.dataset.tab,
preloadVisible: true,
pageSize: 10,
pageIndex: 1,
loadType: 'more',
isShow: false
})
this.selectComponent("#" + this.data.selectTab).getUnpassedList(this.data)
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
// 判断是否需要在加载数据
if (this.data.listLength !== this.data.pageSize) {
this.setData({
loadType: 'none',
})
return
}
this.setData({
loadType: 'more',
})
let obj = {
pageIndex: ++this.data.pageIndex,
pageSize: this.data.pageSize,
}
this.selectComponent("#" + this.data.selectTab).getUnpassedList(this.data)
},
})