APICloud上啦加载下拉刷新模块
2024-10-01 04:56:42
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
});
}
最新文章
- JS事件对象与事件委托
- SOAPUI使用教程-MockServices工作原理
- [ios学习笔记之视图、绘制和手势识别]
- javascript通过时区获取时间
- (转)create table #temptable 临时表 和 declare @bianliang table ()表变量
- PROCESS_YIELD()宏和C语言的switch语句<; contiki学习笔记之七>;
- 字符串(AC自动机):HDU 5129 Yong Zheng&#39;s Death
- C++中虚函数实现原理揭秘
- 实战 iTextSharp
- 泛泰A870L/K/S第三版官方4.4.2原来的系统卡刷机包 (愿自己主动ROOT)
- UIButton 文字图片排列
- (一) .net core 2.0 初体验
- JDK1.8源码(三)——java.util.HashMap
- a = a + 1, a++, ++a ,a+=1区别在哪
- Sessions Hang on row cache lock
- 初始js闭包&;事件的冒泡和捕获&;EVENT对象
- Linux文件系统及文件类型
- WOW
- JS控制只能输入数字并且最多允许小数点两位
- Linux共享内存的管理
热门文章
- hdu 3064
- [cf 599A]Patrick and Shopping
- OSI七层参考模型每一层都有哪些协议
- [poj3735] Training little cats_矩乘快速幂
- MyBatis 3模糊查询(like)写法(转)
- NTP-网络时间协议
- 3.2 Piecewise Linear Interpolation(站点)
- Zepto Code Rush 2014-A. Feed with Candy(HACK)
- Android 65K问题之Multidex原理分析及NoClassDefFoundError的解决方法
- SharePoint 2013 改动表单认证登录页面