1. 使用npm 安装 
  npm i vue-scroller -S
  地址: https://github.com/wangdahoo/vue-scroller
2. 引入 main.js:
  import Vue from 'vue'
  import VueScroller from 'vue-scroller'
  Vue.use(VueScroller) 3.页面使用
 <template>
<div class="container" style="height:100%;overflow: scroll;">
<section class="bg-white" style="height:100%;overflow: scroll;">
<!-- navbar -->
<mt-navbar class="page-part" v-model="selected">
<mt-tab-item :id="1">未完成</mt-tab-item>
<mt-tab-item :id="0">已完成</mt-tab-item>
</mt-navbar>
<!-- tabcontainer -->
<mt-tab-container v-model="selected">
<scroller :on-infinite="infinite" ref="my_scroller">
<div style="height: 44px; margin-top: -44px;"></div>
<div class="itemContent clear" v-for="(item,index) in listData" :key="index" @click="toDetail(item.sign_url)">
<p class="itemTitle clear">
<span class="fl itemTitle-name">{{item.flow_id}}{{item.contract_name}}</span>
<span v-if="selected==0" :class="(item.sign_status_employee==1?'itemTitle-state-green':(item.sign_status_employee==3?'itemTitle-state-red':'itemTitle-state-gray'))" class="fr itemTitle-state">{{item.sign_status_employee | showState}}</span>
<span v-if="selected==1" class="fr itemTitle-state itemTitle-state-blue">待签署</span>
</p>
<div class="itemDetail m14">
<div class="fl itemTime">
<p>开始日期:{{item.start_time}}</p>
<p>失效日期:{{item.lose_efficacy_time}}</p>
</div>
<div class="fr" v-if="selected==0">
<div v-if="item.sign_status_employee==1" @click.stop="openDownload(item.flow_id)">
<i class="itemBtn icon iconfont icon-upload_icon"></i>
</div>
</div>
</div>
</div>
</scroller>
</mt-tab-container>
</section>
</div>
</template> <script>
import { Navbar, TabItem, Toast, Indicator } from 'mint-ui';
import { getListData, getDownloadUrl } from '@/api/api'; export default {
name: 'page-navbar',
data() {
return {
employeeId: '', //易路员工编号
selected: 1, //completed (0:已完成,1:未完成)
pageNo: 0,//当前页
pageSize: 10,//页面条数
maxpage: 0,//最大页码数
counts: 0,//总条数
listData: []//列表数据
};
},
watch: {
//监听tab切换
selected: function(val, oldVal) {
this.pageNo = 0;
this.selected = val;
this.listData = [];
this.$refs.my_scroller.finishInfinite(false); //详情见 备注
}
},
mounted() {
//截取易路员工编号
this.employeeId = this.$utils.getUrlKey("accesskey");
// this.employeeId='yl001';
},
methods: {
infinite(done) {
this.pageNo++;
var self1 = this;
setTimeout(() => {
var params = {
accesskey: this.employeeId,
completed: this.selected,
page: this.pageNo,
pageSize: this.pageSize
};
//获取列表数据
getListData(params).then(res => {
if(res.data.code == 0) {
var re = res.data.model[0];
if(re.length > 0) {
this.counts = re[0].rows;
var n = re[0].rows;
var m = this.pageSize;
if(n % m > 0) {
this.maxpage = parseInt(n / m) + 1;
} else {
this.maxpage = parseInt(n / m);
}
if(this.pageNo > this.maxpage) {
self1.noData = "没有更多数据"
done(true);
return;
} else {
done();
this.listData = this.listData.concat(res.data.model[0]);
}
} else {
self1.noData = "没有更多数据"
done(true);
return;
}
} else {
Toast({
message: res.data.msg
});
done(true);
return;
}
})
}, 1500)
}, //row跳转详情页面
toDetail(sign_url) {
console.log("列表id==" + sign_url)
window.location.href = sign_url;
},
//打开下载页面
openDownload(flow_id) {
console.log("下载id==" + flow_id);
var params = {
flowId: 143
};
getDownloadUrl(params).then(res => {
console.log(res);
if(res.data.code == 0) {
window.location.href = res.data.model[0].downloadUrl;
}
})
}
}
}
</script>
<style rel="stylesheet/less" lang="less" scoped>
.container {
overflow: auto;
-webkit-overflow-scrolling: touch;
/*修改nav默认样式*/
.mint-navbar .mint-tab-item.is-selected {
color: #788897 !important;
}
.mint-tab-item {
.mint-tab-item-label {
font-size: 18px !important;
}
}
.page-part {
margin-bottom: 2px;
}
.scroller {
overflow: scroll;
}
.itemContent {
border-top: 1px solid #F2F2F2;
padding: 20px 0;
.itemTitle {
color: #2b2b2b;
margin: 0 14px;
.itemTitle-name {
font-weight: bolder;
font-size: 16px;
}
.itemTitle-state {
padding: 0 6px;
height: 16px;
line-height: 16px;
border-radius: 2px;
}
.itemTitle-state-blue {
border: 1px solid #617fde;
color: #617fde
}
.itemTitle-state-red {
border: 1px solid #f05d6e;
color: #f05d6e;
}
.itemTitle-state-green {
border: 1px solid #24c875;
color: #24c875;
}
.itemTitle-state-gray {
border: 1px solid #d8d8d8;
color: #d8d8d8
}
}
.itemDetail {
.itemTime {
width: calc(100% - 85px);
color: #bebebe;
}
.itemBtn {
padding: 0 14px;
height: 18px;
line-height: 18px;
color: #A4ACB6;
}
}
}
}
</style>
 备注: finishInfinite(isNoMoreData :Boolean)   当参数为false时,上拉获取数据可以重新调用。
当参数为true,上拉获取数据回调函数停止使用,下拉下部不再显示loading,会显示‘’暂无更多数据 效果如下:

vue scrolle在tab 中使用的更多相关文章

  1. 仅在TabControl中的Tab中添加右键菜单

    若想实现仅在TabControl中的Tab中添加右键菜单,可在XAML中通过使用样式得到: <TabControl> <TabControl.ItemContainerStyle&g ...

  2. Tabhost嵌套以及Tab中多个Activity跳转的实现

    做了一个demo,先看看效果图: 源码 如下: () DoubleTabHost package yy.android.tab; import android.app.TabActivity; imp ...

  3. 如何在vue单页应用中使用百度地图

    作为一名开发人员,每次接到开发任务,我们首先应该先分析需求,然后再思考技术方案和解决方案.三思而后行,这是一个好的习惯. 需求:本项目是采用vue组件化开发的单页应用项目,现需要在项目中引入百度的地图 ...

  4. 基于vue项目的组件中导入mui框架初始化滑动等效果时需移除严格模式的问题

    基于vue项目的组件中导入mui框架初始化滑动等效果时,控制台报错:Uncaught TypeError: 'caller', 'callee', and 'arguments' properties ...

  5. vue 如何在循环中绑定v-model

    vue 如何在循环中绑定v-model 我现在有这么一个需求,页面上有多项输入框,但是具体有多少项,我也不知道,它是通过"新增一项"按钮点击事件,点击一下,就新增一项:如下图这个样 ...

  6. 坑!vue.js在ios9中失效

    坑!vue.js在ios9中失效! 接到实现,在移动端生成一个分享链接,分享到微信,在微信中打开,加入! 好,用vue实现----------------------->写代码--------- ...

  7. vue生命周期图示中英文版Vue实例生命周期钩子

    vue生命周期图示中英文版Vue实例生命周期钩子知乎上近日有人发起了一个 “react 是不是比 vue 牛皮,为什么?” 的问题,Vue.js 作者尤雨溪12月4日正面回应了该问题.以下是尤雨溪回复 ...

  8. 黄聪:360、chrome开发插件扩展如何跨域调用其他网站的信息并且显示在扩展、tab中的api

    chrome插件提供了查找tab的api chrome.tabs.get(integer tabId, function callback) 但是出于安全的考虑,tab的属性中没有document 因 ...

  9. vue 单页应用中微信支付的坑

    vue 单页应用中微信支付的坑 标签(空格分隔): 微信 支付 坑 vue 场景 在微信H5页面(使用 vue-router2 控制路由的 vue2 单页应用项目)中使用微信 jssdk 进行微信支付 ...

随机推荐

  1. git命令行在windows中报错WARNING: terminal is not fully functional

    今天在windows的PowerShell中执行git log命令的时候报错: WARNING: terminal is not fully functional 网上查找方法,最后 1.打开wind ...

  2. js常用正则表达式判断

    1.判断IP:端口 <html> <head> </head> <body> ip:port<input type="" na ...

  3. 与eslint有关的规范

    https://cloud.tencent.com/developer/section/1135682 腾讯云的规范还是不错的

  4. 实验八 Web基础 SQL注入原理

    实验八 Web基础 实验要求 (1)Web前端HTML 能正常安装.启停Apache.理解HTML,理解表单,理解GET与POST方法,编写一个含有表单的HTML. (2)Web前端javascipt ...

  5. 《Redis 命令操作》

    一:Redis 的启动与关闭 - 关闭指定端口的 Redis - redis-cli -p 9200 shutdown - 开启 Redis - redis-server redis.config 二 ...

  6. 软件开发项目组各职能介绍 & 测试人员在团队中的定位

    前言     接触了许多非测试和新入行的测试从业者,听到最多的问题就是:“测试是否被需要?“   团队职能介绍     <暗黑者1>中有句台词,“专案组有五个职能角色构成,侦探.网警.痕迹 ...

  7. [vue开发记录]float label输入框

    上图: 组件代码: <!-- Created by Locke Ou on 2018/6/20. --> <template> <div> <div clas ...

  8. Scala集合Map

    在scala中Map分为可变长(mutable)和不可变长(immutable) /** * 不可变长map 长度一旦初始化,就不能在进行更改 */ // 通过箭头的方式创建map val map = ...

  9. Kali-Dos洪水攻击之Hping3

    在计算机行业,拒绝服务(DoS)或分布式拒绝服务(DDoS)攻击是指不法分子企图让某机器或网络资源无法被预期的用户所使用.虽然执行DoS攻击的方式.动机和目标不一样,但通常包括设法临时性或无限期中断或 ...

  10. elasticsearch开机启动脚本

    最近搭建了一个elasticsearch服务,其中机器重启而ES服务没有重启是问题,就有下面的脚本 #!/bin/sh #chkconfig: #description: es export JAVA ...