安装

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. Jira未授权SSRF漏洞复现(CVE-2019-8451)

    0x00 漏洞背景 Jira的/plugins/servlet/gadgets/makeRequest资源存在SSRF漏洞,原因在于JiraWhitelist这个类的逻辑缺陷,成功利用此漏洞的远程攻击 ...

  2. flink batch wordcount

    1.POJO方式 public class WordCountPojo { public static class Word{ private String word; private int fre ...

  3. jvm运行时数据区之程序计数器

    什么是程序计数器? 程序计数器是一块 较小 的内存空间,它可以看做是当前线程所执行的字节码的 行号指示器 :在虚拟机的概念模型里(仅仅是概念模型,各种虚拟机可能会通过一些更高效的方式去实现),字节码解 ...

  4. 使用 Spring 配置动态数据源实现读写分离

    关键词:DataSource .AbstractRoutingDataSource.AOP 首先是配置数据源 <!--读数据源配置--><bean id="readData ...

  5. 【前端_React】Node.js和webpack的安装

    第一步——安装Node.js 首先要安装Node.js,Node.js自带了软件包管理工具npm,可以使用npm安装各种插件.Node.js的下载地址 可以自定义安装到指定的路径下,待安装完成后命令行 ...

  6. python使用sched模块执行周期性任务和定时任务

    执行周期性任务 sched模块是一个通用的事件调度程序,可以对任务进行延迟调度,基于此,可以用它来实现周期性任务. # coding:utf8 import time import sched # 初 ...

  7. nginx的 ngx.var ngx.ctx ngx.req

    ngx.var 是获取 Nginx 的变量,需要经历字符串 hash.hash 表查找等过程. ngx.ctx 仅仅是一个 Lua table 而已,它的引用存放在 ngx_lua 的模块上下文(ct ...

  8. Linux操作系统的日志管理之rsyslog实战案例

    Linux操作系统的日志管理之rsyslog实战案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.日志介绍 1>.什么是日志 历史事件: 时间,地点,人物,事件 日志级 ...

  9. flask-restful在解析的请求一定要传content-type:application/json吗?答:其实不需要!

    在处理flask-restful api请求时,因为postman发送的格式为text,没有携带content-type:application/json,在解析参数的时候,参数的值都给搞成了空,导致 ...

  10. HTML基础二-DOM操作

    http://www.imdsx.cn/index.php/2017/07/27/html2/ DOM(Document Object Model 文档对象模型) 一个web页面的展示,是由html标 ...