mint-ui之Loadmore使用
<template>
<div class="page-loadmore">
<div class="page-loadmore-wrapper" ref="wrapper" :style="{ height: wrapperHeight + 'px' }">
<mt-loadmore :top-method="loadTop" @translate-change="translateChange" @top-status-change="handleTopChange" :bottom-method="loadBottom" @bottom-status-change="handleBottomChange" :bottom-all-loaded="allLoaded" ref="loadmore">
<ul class="page-loadmore-list">
<li v-for="item in list" class="page-loadmore-listitem">{{ item }}</li>
</ul>
<div slot="top" class="mint-loadmore-top">
<span v-show="topStatus !== 'loading'" :class="{ 'is-rotate': topStatus === 'drop' }">↓</span>
<span v-show="topStatus === 'loading'">
<mt-spinner type="snake"></mt-spinner>
</span>
</div>
<div slot="bottom" class="mint-loadmore-bottom">
<span v-show="bottomStatus !== 'loading'" :class="{ 'is-rotate': bottomStatus === 'drop' }">↑</span>
<span v-show="bottomStatus === 'loading'">
<mt-spinner type="snake"></mt-spinner>
</span>
</div>
</mt-loadmore>
</div>
</div>
</template> <script>
export default {
data() {
return {
list: [],
allLoaded: false,
bottomStatus: '',
wrapperHeight: 0,
topStatus: '',
//wrapperHeight: 0,
translate: 0,
moveTranslate: 0
};
},
methods: {
handleBottomChange(status) {
this.bottomStatus = status;
},
loadBottom() {
setTimeout(() => {
let lastValue = this.list[this.list.length - 1];
if (lastValue < 100) {
for (let i = 1; i <= 10; i++) {
this.list.push(lastValue + i);
}
} else {
this.allLoaded = true;
}
this.$refs.loadmore.onBottomLoaded();
}, 1500);
},
handleTopChange(status) {
this.moveTranslate = 1;
this.topStatus = status;
},
translateChange(translate) {
const translateNum = +translate;
this.translate = translateNum.toFixed(2);
this.moveTranslate = (1 + translateNum / 70).toFixed(2);
},
loadTop() {
setTimeout(() => {
let firstValue = this.list[0];
for (let i = 1; i <= 10; i++) {
this.list.unshift(firstValue - i);
}
this.$refs.loadmore.onTopLoaded();
}, 1500);
} },
created() {
for (let i = 1; i <= 20; i++) {
this.list.push(i);
}
},
mounted() {
this.wrapperHeight = document.documentElement.clientHeight - this.$refs.wrapper.getBoundingClientRect().top;
}
};
</script> <style>
.loading-background,
.mint-loadmore-top span {
-webkit-transition: .2s linear;
transition: .2s linear
} .mint-loadmore-top span {
display: inline-block;
vertical-align: middle
} .mint-loadmore-top span.is-rotate {
-webkit-transform: rotate(180deg);
transform: rotate(180deg)
} .page-loadmore .mint-spinner {
display: inline-block;
vertical-align: middle
} .page-loadmore-desc {
text-align: center;
color: #666;
padding-bottom: 5px
} .page-loadmore-desc:last-of-type,
.page-loadmore-listitem {
border-bottom: 1px solid #eee
} .page-loadmore-listitem {
height: 50px;
line-height: 50px;
text-align: center
} .page-loadmore-listitem:first-child {
border-top: 1px solid #eee
} .page-loadmore-wrapper {
overflow: scroll
} .mint-loadmore-bottom span {
display: inline-block;
-webkit-transition: .2s linear;
transition: .2s linear;
vertical-align: middle
} .mint-loadmore-bottom span.is-rotate {
-webkit-transform: rotate(180deg);
transform: rotate(180deg)
}
</style>

mint-ui之Loadmore使用的更多相关文章
- Mint UI 之loadmore组件的坑:内部元素头部被遮挡了一部分
前端经常会遇到数据分页加载的需求,mint-ui组件为大家提供了loadmore组件 但是我在使用的时候,遇到了一个问题:写好布局和样式以及逻辑之后,我的mt-loadmore标签的头部总是不顶在父元 ...
- vue mint ui 手册文档对于墙的恐惧
http://www.cnblogs.com/smallteeth/p/6901610.html npm 安装 推荐使用 npm 的方式安装,它能更好地和 webpack 打包工具配合使用. npm ...
- vue mint ui 手册文档
npm 安装 推荐使用 npm 的方式安装,它能更好地和 webpack 打包工具配合使用. npm i mint-ui -S CDN 目前可以通过 unpkg.com/mint-ui 获取到最新版本 ...
- vue mint UI
vue 与mint UI 结合开发手机app html5页面 api 文档 http://mint-ui.github.io/#!/zh-cn
- 基于VUE.JS的移动端框架Mint UI
Mint UI GitHub:github.com/ElemeFE/mint 项目主页:mint-ui.github.io/# Demo:elemefe.github.io/mint- 文档:mint ...
- Mint UI文档
Mint UI文档:http://elemefe.github.io/mint-ui/#/ 一.Mint UI的安装和基本用法. 1.NPM :npm i mint-ui -S 建议使用npm进行安装 ...
- 新建一个基于vue.js+Mint UI的项目
上篇文章里面讲到如何新建一个基于vue,js的项目(详细文章请戳用Vue创建一个新的项目). 该项目如果需要组件等都需要自己去写,今天就学习一下如何新建一个基于vue.js+Mint UI的项目,直接 ...
- iView webapp / Mint UI / MUI [前端UI]
前端UI iView webapp一套高质量的 微信小程序 UI 组件库 https://weapp.iviewui.com/?from=iview Mint UI 基于 Vue.js 的移动端组件库 ...
- Mint UI 使用指南
上来直接在webpack里将Mint UI引入项目,发现各种问题.饿了么组件库文档太坑了,好多地方写错,有些该说明的地方没说,比如例子里单文件.vue组件里用的类post-css处理器,我一直使用SA ...
- Mint UI Example的运行
Mint -UI是新推出的移动端UI框架 官网 不过官网上的文档例子不是很全面. 建议下载他们提供的example来学习. 1.examplle源码下载地址 2.打开项目,我这里使用webstorm, ...
随机推荐
- win10升级后,无法ping通vmware的centos解决方法
win10是lenovo thinkpad460上面的,是正版的.无法做设置,不让其自动升级.10月8日节后第一天上班,电脑要求更新,我就点更新. 结果就发现无法ping通vmware中的centos ...
- 编辑器source insight,sublime,编码 utf-8和 GB2312
source insight中,想要UTF-8的中文字符正常显示的话,目前没有直接支持的方法. 暂时只能通过将原UTF-8的格式的文件,转换为本地ANSI编码(此处是简体中文,对应的ANSI编码为GB ...
- python call so
作为一个老程序员,如果,python不能与c发生点儿关系,我都挺过意不去的啊 那么,就解决了这个强迫症吧,阿门! //pycall.c #include <stdio.h> #includ ...
- linux c语言开发工具
---恢复内容开始--- C语言编译全过程剖析 编译的概念:编译程序读取源程序(字符流),对之进行词法和语法的分析,将高级语言指令转换为功能等效的汇编代码,再由汇编程序转换为机器语言,并且按照操作系统 ...
- Linux 7.x 设置主机名称
Linux 7.x 设置主机名称 在Linux7.x 版本中,临时设置主机名称使用指令:hostnamectrl set-name 主机名称 [root@localhost ~]# hostname ...
- Mac虚拟机上使用Genumotion模拟器
在Mac虚拟机系统上开发ReactNative的IOS应用非常方便,只要安装Xcode即可, 但 Android应用就需要三个步骤: 首先声明,下载Android SDK会非常慢,最好有快速的网络或 ...
- 认识ZTree
ZTree基本知识 zTree 是一个依靠 jQuery 实现的多功能 “树插件”.优异的性能.灵活的配置.多种功能的组合是 zTree 最大优点. 一.最简单的树(标准的json数据): 1.set ...
- html5-button元素
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8&qu ...
- 从零开始学习cocoStudio(1)--cocoStudio是什么?
一.cocoStudio是什么? CocoStudio是一套专业的永久免费的游戏开发工具集,帮助开发者快速创建游戏资源,将大部分繁琐的游戏开发工作使用编辑器来快速制作,CocoStudio包含了游戏开 ...
- 使用Oozie中workflow的定时任务重跑hive数仓表的历史分期调度
在数仓和BI系统的开发和使用过程中会经常出现需要重跑数仓中某些或一段时间内的分区数据,原因可能是:1.数据统计和计算逻辑/口径调整,2.发现之前的埋点数据收集出现错误或者埋点出现错误,3.业务数据库出 ...