欧洲变态另类zozo,欧美xxxx做受欧美gaybdsm,欧洲熟妇色xxxx欧美老妇软件,免费人成视频xvideos入口 ,欧美.日韩.国产.中文字幕

歡迎光臨本站
我們一直在努力

關(guān)于微信小程序加載更多和點(diǎn)擊查看更多的代碼

這篇文章主要為大家詳細(xì)介紹了微信小程序加載更多,點(diǎn)擊查看更多功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了微信小程序加載更多功能實(shí)現(xiàn)的具體代碼,供大家參考,具體內(nèi)容如下

微信小程序加載更多,是將之前的數(shù)據(jù)和點(diǎn)擊加載后請(qǐng)求的數(shù)據(jù)用concat拼接在一起并執(zhí)行setData,下面是一個(gè)簡(jiǎn)單的栗子:

index.wxml代碼如下

<view wx:for="{{duanziInfo}}" wx:for-item="name" wx:for-index="id"> 
 <view class="duanzi-view"> 
 <view class="duanzi-content"> 
 <text class="dz-content">{{name.content}}</text> 
 </view> 
 </view> 
</view> 
<view class="button-wrapper"> 
 <button type="default" size="default" loading="{{loading}}" disabled="{{disabled}}" bindtap="setLoading"> 
 {{loadText}} 
 </button> 
</view>
登錄后復(fù)制

加載更多按鈕綁定setLoading

index.js文件代碼如下

Page({ 
 data: { 
  loadText:'加載更多', 
  duanziInfo:[] 
 }, 
 //初始化請(qǐng)求 
 onLoad: function (res) { 
 var that = this 
 //內(nèi)容 
 wx.request({ 
  url: 'http://xxxxx.com/index.php?m=Industry&a=getDuanziInfo', 
  data: {token:token}, 
  method: 'GET', 
  success: function(res){ 
  console.log(res.data.result) //打印初始化數(shù)據(jù) 
  that.setData({ 
  duanziInfo:res.data.result 
  }) 
  } 
 }) 
 }, 
 //加載更多 
 setLoading: function(e) { 
 var duanziInfoBefore = this.data.duanziInfo 
 var that = this 
 wx.showToast({ //期間為了顯示效果可以添加一個(gè)過(guò)度的彈出框提示“加載中” 
  title: '加載中', 
  icon: 'loading', 
  duration: 200 
  }) 
 wx.request({ 
  url: 'http://xxxxx.com/index.php?m=Industry&a=getDuanziInfo', 
  data: {token:token}, 
  method: 'GET', 
  success: function(res){ 
  console.log(duanziInfoBefore.concat(res.data.result)) //打印拼接之后數(shù)據(jù) 
  that.setData({ 
  loadText:"數(shù)據(jù)請(qǐng)求中", 
  loading:true, 
  duanziInfo:duanziInfoBefore.concat(res.data.result), 
  loadText:"加載更多", 
  loading:false, 
  }) 
  } 
 }) 
 } 
})
登錄后復(fù)制

初始化和加載更多中的打印數(shù)據(jù)如下

(以上是點(diǎn)擊查看更多,還可以根據(jù)距離視圖區(qū)域的距離來(lái)加載更多,具體實(shí)現(xiàn)是將視圖用

標(biāo)簽,并給其一個(gè)固定高度,在給定參數(shù)中設(shè)置距離像素觸發(fā)事件。具體文檔:https://mp.weixin.qq.com/debug/wxadoc/dev/component/scroll-view.html?t=20161122)

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,更多相關(guān)內(nèi)容請(qǐng)關(guān)注PHP中文網(wǎng)!

相關(guān)推薦:

以上就是關(guān)于微信小程序加載更多和點(diǎn)擊查看更多的代碼的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注有卡有網(wǎng)。

版權(quán)聲明:本文采用知識(shí)共享 署名4.0國(guó)際許可協(xié)議 [BY-NC-SA] 進(jìn)行授權(quán)
文章名稱(chēng):《關(guān)于微信小程序加載更多和點(diǎn)擊查看更多的代碼》
文章鏈接:http://www.ljxxtl.cn/kaquan-baike/xcx/154673.html
本站資源僅供個(gè)人學(xué)習(xí)交流,請(qǐng)于下載后24小時(shí)內(nèi)刪除,不允許用于商業(yè)用途,否則法律問(wèn)題自行承擔(dān)。