apicloud有自带的上啦加载下拉刷新,当让也可以用第三方或者在模块库里面找一个使用

一、下拉刷新,一下代码写在

apiready = function (){} 里面
apiready = function (){
//下拉刷新
api.setRefreshHeaderInfo({
visible: true,
bgColor: 'rgba(0,0,0,0)',
textColor: '#666',
textDown: '下拉刷新',
textUp: '释放刷新'
}, function(ret, err){
toDoRequest();
});
}; // 刷新 初始化加载
function toDoRequest(){
setTimeout(function(){
api.refreshHeaderLoadDone(); //复位下拉刷新
api.toast({
msg:'已经是最新数据了',
duration:'',
localtion:'middle'
});
},)
}

二、实现加载更多:

通过监听页面滚动到底部事件来实现:

apiready = function(){
api. addEventListener({name:'scrolltobottom'}, function(ret, err){
//refresh event callback
toDoRequest();
});
} //do ajax
function toDoRequest(){
// GET、POST、PUT、DELETE、…
api.ajax({
url:'http://xxx.xxx.xxx'
}, function(ret, err){
//do your business
});
}

最新文章

  1. JS事件对象与事件委托
  2. SOAPUI使用教程-MockServices工作原理
  3. [ios学习笔记之视图、绘制和手势识别]
  4. javascript通过时区获取时间
  5. (转)create table #temptable 临时表 和 declare @bianliang table ()表变量
  6. PROCESS_YIELD()宏和C语言的switch语句< contiki学习笔记之七>
  7. 字符串(AC自动机):HDU 5129 Yong Zheng's Death
  8. C++中虚函数实现原理揭秘
  9. 实战 iTextSharp
  10. 泛泰A870L/K/S第三版官方4.4.2原来的系统卡刷机包 (愿自己主动ROOT)
  11. UIButton 文字图片排列
  12. (一) .net core 2.0 初体验
  13. JDK1.8源码(三)——java.util.HashMap
  14. a = a + 1, a++, ++a ,a+=1区别在哪
  15. Sessions Hang on row cache lock
  16. 初始js闭包&事件的冒泡和捕获&EVENT对象
  17. Linux文件系统及文件类型
  18. WOW
  19. JS控制只能输入数字并且最多允许小数点两位
  20. Linux共享内存的管理

热门文章

  1. hdu 3064
  2. [cf 599A]Patrick and Shopping
  3. OSI七层参考模型每一层都有哪些协议
  4. [poj3735] Training little cats_矩乘快速幂
  5. MyBatis 3模糊查询(like)写法(转)
  6. NTP-网络时间协议
  7. 3.2 Piecewise Linear Interpolation(站点)
  8. Zepto Code Rush 2014-A. Feed with Candy(HACK)
  9. Android 65K问题之Multidex原理分析及NoClassDefFoundError的解决方法
  10. SharePoint 2013 改动表单认证登录页面