内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

微信小程序中的加載更多(即列表分頁)

2021-04-20    分類: 微信小程序

1.app.json中:

"window": {

  "enablePullDownRefresh": true //是否開啟當(dāng)前頁面下拉刷新

}

2.wxml中:

          {{item.title}}     {{item.inputtime}}              {{item.content}}      

3.js中:

data: {     hidden: true,                          //隱藏表單控件         page: 1,                              //當(dāng)前請求數(shù)據(jù)是第幾頁         pageSize: 10,                          //每頁數(shù)據(jù)條數(shù)         hasMoreData: true,                      //上拉時(shí)是否繼續(xù)請求數(shù)據(jù),即是否還有更多數(shù)據(jù)         contentlist: [],                        //獲取的數(shù)據(jù)列表,以追加的形式添加進(jìn)去 }, // 獲取分頁列表 getInfo: function (message) {     var that = this;     wx.showNavigationBarLoading()              //在當(dāng)前頁面顯示導(dǎo)航條加載動畫     wx.showLoading({                        //顯示 loading 提示框         title: message,     })     wx.request({         url: 'http://localhost:88/wechat/test.php',    //本地設(shè)置不校驗(yàn)合法域名         data: { page: that.data.page, count: that.data.pageSize },         method: 'post',         header: { 'content-type': 'application/x-www-form-urlencoded' },         success: function (res) {             var contentlistTem = that.data.contentlist;             if (res.data.length > 0) {                 wx.hideNavigationBarLoading()     //在當(dāng)前頁面隱藏導(dǎo)航條加載動畫                 wx.hideLoading()               //隱藏 loading 提示框                 if (that.data.page == 1) {                     contentlistTem = []                 }                 var contentlist = res.data;                 if (contentlist.length < that.data.pageSize) {                     that.setData({                         contentlist: contentlistTem.concat(contentlist),                         hasMoreData: false                     })                 } else {                     that.setData({                         contentlist: contentlistTem.concat(contentlist),                         hasMoreData: true,                         page: that.data.page + 1                     })                 }             }         },         fail: function (res) {             wx.hideNavigationBarLoading()             wx.hideLoading()             fail()         },         complete: function (res) {         },     }) }, /** * 生命周期函數(shù)--監(jiān)聽頁面初次渲染完成 */ onLoad: function (options) {     // 頁面初始化 options為頁面跳轉(zhuǎn)所帶來的參數(shù)     var that = this     that.getInfo('正在加載數(shù)據(jù)...') }, /** * 頁面相關(guān)事件處理函數(shù)--監(jiān)聽用戶下拉動作 */ onPullDownRefresh: function () {     this.data.page = 1     this.getInfo('正在刷新數(shù)據(jù)') }, /** * 頁面上拉觸底事件的處理函數(shù) */ onReachBottom: function () {     if (this.data.hasMoreData) {         this.getInfo('加載更多數(shù)據(jù)')     } else {         wx.showToast({             title: '沒有更多數(shù)據(jù)',         })     } } 

分享題目:微信小程序中的加載更多(即列表分頁)
鏈接分享:http://www.rwnh.cn/news/109097.html

網(wǎng)站建設(shè)、網(wǎng)絡(luò)推廣公司-創(chuàng)新互聯(lián),是專注品牌與效果的網(wǎng)站制作,網(wǎng)絡(luò)營銷seo公司;服務(wù)項(xiàng)目有微信小程序

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

猜你還喜歡下面的內(nèi)容

成都seo排名網(wǎng)站優(yōu)化

微信小程序知識

行業(yè)建站

永兴县| 平凉市| 镇平县| 绍兴县| 安丘市| 静宁县| 秭归县| 双柏县| 阿瓦提县| 绿春县| 类乌齐县| 青海省| 柘荣县| 松原市| 抚松县| 林西县| 千阳县| 淮南市| 洪雅县| 溧水县| 昌黎县| 夹江县| 磐安县| 工布江达县| 博客| 横山县| 化州市| 清原| 濉溪县| 师宗县| 江源县| 汶川县| 垦利县| 嘉黎县| 信宜市| 望奎县| 同江市| 嵩明县| 灵宝市| 尚志市| 新干县|