响水做网站哪家公司好,从零开始做网站内容运营,自己做网站哪里最好,公共资源交易中心吃香吗一.scroll-view实现上拉加载
scroll-view组件通过自身一些属性实现上拉加载的功能。
lower-threshold“100属性表示距离底部多少px就会实现触发下拉加载的事件。 类似于在.json文件里面配置onReachBottomDistance”: 100
bindscrolltolowergetMore属…一.scroll-view实现上拉加载
scroll-view组件通过自身一些属性实现上拉加载的功能。
lower-threshold“100属性表示距离底部多少px就会实现触发下拉加载的事件。 类似于在.json文件里面配置onReachBottomDistance”: 100
bindscrolltolowergetMore属性是监听下拉加载的所绑定的方法。 enable-back-to-top属性设置为ture表示点击状态栏或者标题栏回到顶部位置。
代码如下
scroll-view scroll-ytrue
classscroll-ylower-threshold100
bindscrolltolowergetMore
enable-back-to-topview wx:for{{numList}} wx:key*this{{item}}/view
/scroll-view监听下拉事件的方法相当于onReachBottom
getMore(){console.log(2)wx.showLoading({title: 数据加载中...,})setTimeout((){const lastNumthis.data.numList[this.data.numList.length-1]const newAry[lastNum1,lastNum2,lastNum3]this.setData({numList:[...this.data.numList,...newAry]})wx.hideLoading()},1500)}二.上拉刷新
refresher-enabled 是否允许上拉刷新相当于enablePullDownRefresh refresher-default-style“black” 刷新时候的小圆点颜色相当于backgroundTextStyle refresher-background“#f7f7f8” 刷新时候的背景颜色相当于backgroundColor bindrefresherrefresh“refresh” 监听刷新时候的方法相当于onPullDownRefresh refresher-triggered“{{istriggered}}” 刷新完毕后进行刷新区域的关闭相当于方法wx.stopPullDownRefresh()
scroll-view scroll-ytrue
classscroll-yrefresher-enabledrefresher-default-styleblackrefresher-background#f7f7f8bindrefresherrefreshrefreshrefresher-triggered{{istriggered}}view wx:for{{numList}} wx:key*this{{item}}/view
/scroll-view监听刷新事件的方法 refresh(){console.log(1)wx.showToast({title: 下拉刷新...,})this.setData({numList:[1,2,3],istriggered:false})}