十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊
量身定制 + 運營維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
方法一:onPullDownRefresh和onReachBottom方法實現(xiàn)小程序下拉加載和上拉刷新
首先要在json文件里設(shè)置window屬性
設(shè)置js里onPullDownRefresh和onReachBottom方法
下拉加載說明:
當(dāng)處理完數(shù)據(jù)刷新后,wx.stopPullDownRefresh可以停止當(dāng)前頁面的下拉刷新。
onPullDownRefresh(){ console.log('--------下拉刷新-------') wx.showNavigationBarLoading() //在標(biāo)題欄中顯示加載 wx.request({ url: 'https://URL', data: {}, method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT // header: {}, // 設(shè)置請求的 header success: function(res){ // success }, fail: function() { // fail }, complete: function() { // complete wx.hideNavigationBarLoading() //完成停止加載 wx.stopPullDownRefresh() //停止下拉刷新 } })