小程序滚动及相关滚动事件

时间:2021-01-30 17:31:40   收藏:0   阅读:22

scroll-view

<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 //滚动到顶部所需要的事件
})

上拉加载更多

下拉刷新页面

onPullDownRefresh() {
  // 重置商品数组
  this.setData({
    goodsList: [],
  })
  // 重置页码
  this.QueryParams.pagenum = 1
  // 重新请求商品
  this.getGoodsList()
}
getGoodsList() {
    ...
    console.log(‘成功请求到数据‘)
    // 手动关闭刷新过程    
    wx.stopPullDownRefresh()
}
 "window": {
    "enablePullDownRefresh": true //全局
    "backgroundTextStyle": "dark" //顶部显示颜色为白色的三个点
  }

原文:https://www.cnblogs.com/jincanyu/p/14349244.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!