新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
微信小程序下拉加載和上拉刷新兩種實現(xiàn)方法詳解-創(chuàng)新互聯(lián)
方法一:onPullDownRefresh和onReachBottom方法實現(xiàn)小程序下拉加載和上拉刷新
首先要在json文件里設(shè)置window屬性
設(shè)置js里onPullDownRefresh和onReachBottom方法
下拉加載說明:
當處理完數(shù)據(jù)刷新后,wx.stopPullDownRefresh可以停止當前頁面的下拉刷新。
onPullDownRefresh(){ console.log('--------下拉刷新-------') wx.showNavigationBarLoading() //在標題欄中顯示加載 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() //停止下拉刷新 } })
名稱欄目:微信小程序下拉加載和上拉刷新兩種實現(xiàn)方法詳解-創(chuàng)新互聯(lián)
文章路徑:http://fisionsoft.com.cn/article/cejepi.html