此图是最近做的项目中的一页,用的是mui结合vue,用了mui后,觉得是真心难用啊,先不说其他的,就光这个下拉刷新就让人奔溃了,问题层出不穷,不过最后经过努力还是摆平了哈。

1.每次切换到新的标签,都应该重置一下下拉刷新

toTop(){
var scroll= mui('#refreshContainer').scroll();
this.scroll.scrollTo(0,0,0)
that.currenSize=0
this.page=1
mui("#refreshContainer").pullRefresh().refresh(true);
},

2.调用列表的方法

getFoucus(focus,p){
this.current=focus
this.page=p
if(this.page==1){
this.toTop()
}
this.axios.post(this.api + "/project/projectList/getMyFocusOn",$.param({"itcode":this.userMessage.entityCode,'page':this.page,"pageSize":this.pageSize}))
.then(res => {
var result = res.data;
if (result.status == 0) {
this.requesting=false;
if(result.status==0){
this.requesting=false;
if(this.page==1){
this.projectList=result.page.list;
}else{
var lists=result.page.list
this.projectList=this.projectList.concat(lists)
}
this.title=$(".mui-active").html()
this.currenSize+=this.pageSize
this.total=result.page.total
} else {
mui.toast(result.message)
}
}
})
},

3.下拉执行的方法

pullRefresh(){
var vm=this;
mui("#refreshContainer").pullRefresh({
up:{
contentrefresh : "正在加载...",//可选,正在加载状态时,上拉加载控件上显示的标题内容
contentnomore:'没有更多数据了',//可选,请求完毕若没有更多数据时显示的提醒内容;
callback:function(){//必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
setTimeout(()=>{
vm.page++
if(vm.currenSize>=vm.total){
mui('#refreshContainer').pullRefresh().endPullupToRefresh(true);
}else{
vm.getFoucus(vm.current,vm.page)
}
this.endPullupToRefresh(false)
},300);
},
},
})
},

最新文章

  1. 终端mysql Operation not permitted错误解决方案
  2. hadoop入门(3)——hadoop2.0理论基础:安装部署方法
  3. buildroot--uboot&kernel&rootfs全编译工具
  4. perl 引用(一)
  5. Git版本控制教程
  6. DirectX 基础学习系列5 纹理映射
  7. TFS build dotCover StyleCop
  8. hdu4638Group
  9. JSF和Struts的区别概述
  10. python运维开发(二十)----models操作、中间件、缓存、信号、分页
  11. innobackupex 使用说明
  12. ios 给view添加一个渐变的背景色
  13. 基于IdentityServer的系统对接微信公众号
  14. rest-framework之认证组件
  15. 判断字符串a和b是否互为旋转词
  16. Codeforces Round #453 (Div. 1) D. Weighting a Tree(构造)
  17. Windows Service 2012 R2 下如何建立ftp服务器
  18. U3D 垂直同步
  19. c# DataTable 序列化json
  20. Unity3D中人物模型的构成

热门文章

  1. C# 反编译工具之ILSpy
  2. JZ-050-数组中重复的数字
  3. Windows10 1809版本Windows自动更新服务无法禁用问题解决方案
  4. Linux 中如何使用 Htop 监控工具?【网络安全】
  5. python prettytable 模块
  6. 《手把手教你》系列基础篇(八十一)-java+ selenium自动化测试-框架设计基础-TestNG如何暂停执行一些case(详解教程)
  7. VS2022 安装.NET 3.5/.NET 4/.NET 4.5/.NET 4.5.1目标包的方法
  8. 关于如何让写自然溢出hash的无辜孩子见祖宗这件事
  9. 中国软件杯---电力客户行为分析---图表联动echarts-demo(flask)
  10. fiber核心(react 16)?