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) } })