安装

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 框架下拉刷新上拉加载组件的使用的更多相关文章

  1. Vue mint ui用在消息页面上拉加载下拉刷新loadmore 标记

    之前总结过一个页面存在多个下拉加载的处理方式,今天再来说一下在消息页面的上拉加载和下拉刷新,基本上每个app都会有消息页面,会遇到这个需求 需求:每次加载十条数据,上拉加载下拉刷新,并且没有点击查看过 ...

  2. Android 下拉刷新上啦加载SmartRefreshLayout + RecyclerView

    在弄android刷新的时候,可算是耗费了一番功夫,最后发觉有现成的控件,并且非常好用,这里记录一下. 原文是 https://blog.csdn.net/huangxin112/article/de ...

  3. SwipeRefreshLayout实现下拉刷新上滑加载

    1. 效果图 2.RefreshLayout.java package myapplication.com.myapplication; import android.content.Context; ...

  4. Vue Scroller:Vue 下拉刷新及无限加载组件

    Vue Scroller Vue Scroller is a foundational component ofVonic UI. In purpose of smooth scrolling, pu ...

  5. Vue 下拉刷新及无限加载组件

    原文  https://github.com/wangdahoo/vue-scroller 主题 Vue.js Vue Scroller Vue Scroller is a foundational ...

  6. 移动端下拉刷新上拉加载-mescroll.js插件

    最近无意间看到有这么一个上拉刷新下拉加载的插件 -- mescroll.js,个人感觉挺好用的,官网地址是:http://www.mescroll.com 然后我就看了一下文档,简单的写了一个小dem ...

  7. JS+CSS实现的下拉刷新/上拉加载插件

    闲来无事,写了一个当下比较常见的下拉刷新/上拉加载的jquery插件,代码记录在这里,有兴趣将代码写成插件与npm包可以留言. 体验地址:http://owenliang.github.io/pull ...

  8. vue10行代码实现上拉翻页加载更多数据,纯手写js实现下拉刷新上拉翻页不引用任何第三方插件

    vue10行代码实现上拉翻页加载更多数据,纯手写js实现下拉刷新上拉翻页不引用任何第三方插件/库 一提到移动端的下拉刷新上拉翻页,你可能就会想到iScroll插件,没错iScroll是一个高性能,资源 ...

  9. mui下拉刷新上拉加载

    新外卖商家端主页订单大厅页面 使用mui双webview,实现下拉刷新上拉加载 主页面: order_index.html <!doctype html> <html> < ...

随机推荐

  1. web-api POST body object always null

      If the any of values of the request's JSON object are not the same type as expected by the service ...

  2. sqlalchemy相关操作(ORM)

    环境:python3.7,pycharm,mysql ORM(Object-Relational-Mapper) 对象关系映射(ORM)是一种允许您使用面向对象的范例从数据库查询和操作数据的技术,sq ...

  3. springboot+thymeleaf 实现图片文件上传及回显

    1. 创建一个springboot工程, 在此就不多说了(目录结构). 2. 写一个HTML页面 <!DOCTYPE html> <html lang="en" ...

  4. Linux服务器PHP后门查杀

    shell脚本一句话查找PHP一句话木马 # find ./ -name "*.php" |xargs egrep "phpspy|c99sh|milw0rm|eval( ...

  5. C++对c中函数的拓展,函数重载

    函数参数的拓展 inline内联函数 最好 小的函数都写成内联函数, 写上inline 编译器不一定内联, C++中推荐使用内联函数替代宏代码片段 C++中使用inline关键字声明内联函数 内联函数 ...

  6. HDU5126 stars(cdq分治)

    传送门 题意: 先有两种操作,插入和查询,插入操作则插入一个点\((x,y,z)\),查询操作给出两个点\((x_1,y_1,z_1),(x_2,y_2,z_2)\),回答满足\(x_1\leq x\ ...

  7. Linux下使用cx_Oracle的一些配置

    在安装完成cx_Oracle后,import  cx_Oracle时报错,首先查看.bash_profile文件中环境变量配置 # .bash_profile # Get the aliases an ...

  8. mybatis框架,使用foreach实现复杂结果的查询--循环集合数组

    需求:假定现在查询出用户角色是2和3指定的用户列表信息,并进行展示 接口: /** * 需求:传入指定的用户角色,用户角色有1-n,获取这些用户角色下的用户列表信息 * @param roleids ...

  9. 【Tomcat】系统找不到指定的路径

    确认一下端口防火墙是否开放 没开放就开一下:firewall-cmd --zone=public --add-port=9080/tcp --permanent 然后重启: firewall-cmd ...

  10. v2.3.0

    v2.3.1 大版本2,小版本3,fixbug 1