<scroll-view scroll-y class="left_menu" style="height: 300rpx;"> <view class="menu_item" bindtap="handleItemTab" >{{item}}</view> </scroll-view>
更多屬性請查看: (https://developers.weixin.qq.com/miniprogram/dev/component/scroll-view.html)
wx.pageScrollTo({ scrollTop: 0, duration: 300 //滾動到頂部所需要的事件 })
上拉加載更多有兩種實現方式
1.監聽scroll-view上的bindscrolltoupper事件
<scroll-view scroll-y="true" style="height: 300rpx;" bindscrolltoupper="upper"></scroll-view>
upper(e) { console.log('請求更多數據') },
2.使用小程序的聲明周期函數onReachBottom()
onReachBottom(){ console.log('請求更多數據') }
復制onPullDownRefresh() { // 重置商品數組 this.setData({ goodsList: [], }) // 重置頁碼 this.QueryParams.pagenum = 1 // 重新請求商品 this.getGoodsList() }
getGoodsList() { ... console.log('成功請求到數據') // 手動關閉刷新過程 wx.stopPullDownRefresh() }
"window": { "enablePullDownRefresh": true //全局 "backgroundTextStyle": "dark" //頂部顯示顏色為白色的三個點 }