【微信小程序学习笔记】下拉刷新上拉加载的两种姿势
2016-11-09 本文已影响4066人
弓长剑鸣
-
在js文件里直接重写"onPullDownRefresh"和"onReachBottom"方法即可;
-
文档地址:https://mp.weixin.qq.com/debug/wxadoc/dev/framework/app-service/page.html?t=20161107
-
xml
<scroll-view scroll-y = true > ......... </scroll-view>
-
js
onPullDownRefresh: function() { // Do something when pull down. console.log('刷新'); }, onReachBottom: function() { // Do something when page reach bottom. console.log('circle 下一页'); },
-
-
在scroll-view里设定bindscrolltoupper和bindscrolltolower,然后在js里写好触发事件后对应的方法。[注意,使用这个模式一定要设置scroll-view的高度,100%不知道为什么设置后没效果,建议使用100vh]
-
文档地址:https://mp.weixin.qq.com/debug/wxadoc/dev/component/scroll-view.html?t=20161107
-
xml
<scroll-view scroll-y = true bindscrolltolower="loadMore" bindscrolltoupper="refesh"> .......... </scroll-view>
-
js
onPullDownRefresh: function() { // Do something when pull down. console.log('刷新'); }, onReachBottom: function() { // Do something when page reach bottom. console.log('circle 下一页'); },
-