榆山数据端小程序
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.

93 lines
2.1 KiB

Page({
data: {
pageSize: 10,
pageIndex: 1,
listLength: 0,
loadVisible: false,
loadType: 'more',
isShow: false,
newList: [],
preloadVisible: true,
selectTab: 'tab1',
pagename: 'issueList'
},
onShow: function () {
this.setData({
preloadVisible:true
})
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
})
}
}
},
/**
*
*/
onReachBottom: function () {
// 判断是否需要在加载数据
if (this.data.listLength !== this.data.pageSize) {
this.setData({
loadVisible:true,
loadType: 'none',
})
return
}
this.setData({
loadVisible:true,
loadType: 'more',
})
let obj = {
pageIndex: ++this.data.pageIndex,
pageSize: this.data.pageSize,
}
this.selectComponent("#" + this.data.selectTab).getUnpassedList(this.data)
},
/**
* --
*/
// onPullDownRefresh: function (options) {
// console.log('::::::::::')
// },
// tab 切换
onTabChange(e: AnyObject) {
wx.pageScrollTo({
scrollTop: 0,
duration: 300
})
// if (wx.pageScrollTo) {
// wx.pageScrollTo({
// scrollTop: 0
// })
// } else {
// wx.showModal({
// title: '提示',
// content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
// })
// }
this.setData({
selectTab: e.currentTarget.dataset.tab,
preloadVisible: true,
pageSize: 10,
pageIndex: 1,
loadType: 'more',
isShow: false
})
this.selectComponent("#" + this.data.selectTab).getUnpassedList(this.data)
}
})