vue mint-ui 框架下拉刷新上拉加载组件的使用
安装
npm i mint-ui -S
然后在main.js中引入
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
Vue.use(MintUI)
下拉刷新上拉加载更多数据
<mt-loadmore :top-method="loadTop" :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" ref="loadmore">
<ul class="track-list">
<li class="track-item" v-for="(item,index) in list" :key="index">
哎哎哎
</li>
</ul>
</mt-loadmore>
- top-method绑定的是下拉刷新触发的方法
- bottom-method是上拉加载触发的方法
- bottom-all-loaded绑定的是否已加载完全部数据 ,默认为false,如果全部加载完数据之后,将allLoaded设置为true,这样就不会再去触发上拉加载的方法了
this.allLoaded = true;
全部代码
<mt-loadmore :top-method="loadTop" :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" ref="loadmore">
<ul class="track-list" v-if="list.length!==0">
<li class="track-item" v-for="(item,index) in list" :key="index">
<div class="location"><span class="iconfont icon-location"></span>{{item.address}}附近</div>
<div class="time"><span class="iconfont icon-time"></span>{{item.dateCreated}}</div>
</li>
</ul>
<div class="no-data" v-else>暂无孩子轨迹位置信息</div>
</mt-loadmore>
// 下拉刷新
loadTop(){
this.curPage = 1
this.getChildLocationList()
},
// 加载更多数据
loadBottom(){
this.curPage +=1
this.getChildLocationList()
},
getChildLocationList(){
this.allLoaded = false
let dateCreated = this.dateCreated
this.$api.childLocationList({
params:{
id:this.uid,
cid:this.curChildId,
dateCreated:dateCreated,
isPager:1,//0-不分页,1-分页;
pageNum:this.curPage,//第几页
pageSize:this.pageSize//每页显示数据条数
}
}).then(res=>{
if(res.code==2000){
if(res.row){
let _list = res.row.list
this.curPage = res.row.pageNum
this.pageSize = res.row.pageSize
let totalPages = res.row.pages//总页数
// 下拉刷新 加载更多
setTimeout(() => {
this.$refs.loadmore.onTopLoaded();
this.$refs.loadmore.onBottomLoaded();
}, 1000);
if(this.curPage==1){
this.list = _list;
}else{
if(this.curPage==totalPages){
this.allLoaded = true;// 若数据已全部获取完毕
}
this.list = this.list.concat(_list);//数组追加
}
}else{
this.$refs.loadmore.onTopLoaded();
this.allLoaded = true;// 若数据已全部获取完毕
this.list = []
}
}else{
this.$refs.loadmore.onTopLoaded();
}
})
},
vue mint-ui 框架下拉刷新上拉加载组件的使用的更多相关文章
- Vue mint ui用在消息页面上拉加载下拉刷新loadmore 标记
之前总结过一个页面存在多个下拉加载的处理方式,今天再来说一下在消息页面的上拉加载和下拉刷新,基本上每个app都会有消息页面,会遇到这个需求 需求:每次加载十条数据,上拉加载下拉刷新,并且没有点击查看过 ...
- Android 下拉刷新上啦加载SmartRefreshLayout + RecyclerView
在弄android刷新的时候,可算是耗费了一番功夫,最后发觉有现成的控件,并且非常好用,这里记录一下. 原文是 https://blog.csdn.net/huangxin112/article/de ...
- SwipeRefreshLayout实现下拉刷新上滑加载
1. 效果图 2.RefreshLayout.java package myapplication.com.myapplication; import android.content.Context; ...
- Vue Scroller:Vue 下拉刷新及无限加载组件
Vue Scroller Vue Scroller is a foundational component ofVonic UI. In purpose of smooth scrolling, pu ...
- Vue 下拉刷新及无限加载组件
原文 https://github.com/wangdahoo/vue-scroller 主题 Vue.js Vue Scroller Vue Scroller is a foundational ...
- 移动端下拉刷新上拉加载-mescroll.js插件
最近无意间看到有这么一个上拉刷新下拉加载的插件 -- mescroll.js,个人感觉挺好用的,官网地址是:http://www.mescroll.com 然后我就看了一下文档,简单的写了一个小dem ...
- JS+CSS实现的下拉刷新/上拉加载插件
闲来无事,写了一个当下比较常见的下拉刷新/上拉加载的jquery插件,代码记录在这里,有兴趣将代码写成插件与npm包可以留言. 体验地址:http://owenliang.github.io/pull ...
- vue10行代码实现上拉翻页加载更多数据,纯手写js实现下拉刷新上拉翻页不引用任何第三方插件
vue10行代码实现上拉翻页加载更多数据,纯手写js实现下拉刷新上拉翻页不引用任何第三方插件/库 一提到移动端的下拉刷新上拉翻页,你可能就会想到iScroll插件,没错iScroll是一个高性能,资源 ...
- mui下拉刷新上拉加载
新外卖商家端主页订单大厅页面 使用mui双webview,实现下拉刷新上拉加载 主页面: order_index.html <!doctype html> <html> < ...
随机推荐
- mysql查询表大小
工作中常用命令参考,收集如下: 查询表大小:select table_name, data_length from information_schema.tables where table_sche ...
- 使用fio命令查看磁盘iops
具体命令: fio -filename=./localhost.2019-05-08.log -direct=1 -iodepth 1 -thread -rw=randrw -ioengine=psy ...
- Nginx Rewrite相关功能-防盗链
Nginx Rewrite相关功能-防盗链 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.
- Java八大排序之堆排序
堆排序(英语:Heapsort)是指利用堆这种数据结构所设计的一种排序算法.堆是一个近似完全二叉树的结构,并同时满足堆积的性质:即子结点的键值或索引总是小于(或者大于)它的父节点. 根据根结点是否是最 ...
- <人人都懂设计模式>-中介模式
真正的用房屋中介来作例子, 好的书籍总是让人记忆深刻. class HouseInfo: def __init__(self, area, price, has_window, has_bathroo ...
- 03-docker入门-创建 docker 镜像
方法1:从运行的容器创建方法2:编写 DockFile 文件创建 方法1: 打包镜像 docker commit -m "Test a change" 610 ubuntu:tes ...
- 2016 ACM/ICPC亚洲区青岛站
A B C D E F G H I J K L M O O O O $\varnothing$ $\varnothing$ $\varnothing$ $\varnothing$ ...
- no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]]
今天down了一个开源项目,启动后一直存在如下错误信息: ERROR in ch.qos.logback.core.joran.spi.Interpreter@26:42 - no applicabl ...
- q1096
一,看题 1,大概是每个点都来一次BFS标记下应该就可以. 2,你可以想想队列为啥pop()是l++; 3,还是字符你得注意下. 4,x,y,m,n,行列你得搞清楚. 5,这棋盘的破东西.. 6,额, ...
- Android 开发基础入门篇: 复制一个工程作为一个新的工程
说明 咱们做项目很多时候都需要复制一份工程出来作为一个新的工程 把第一节的工程拷贝到这一节 修改工程名字 打开软件导入此工程 修改包名 第一节的时候说了,一个APP一个包名 自行添加修改 自行修改 自 ...