vue.js 列表数据加载更多
来源:互联网 发布:挂号网软件 编辑:程序博客网 时间:2024/06/05 14:35
<template>
<div>
<!--header-->
<com-header :title="headerData.title" :toLink="headerData.toLink"></com-header>
<!--header end-->
<!--container-->
<div>
<a class="mint-cell">
<div class="mint-cell-wrapper">
<div class="mint-cell-title">
<div class="hhxh-flex">
<div class="flex-0 text-center w-25 gray">时间</div>
<div class="flex-0 text-center w-25 gray">用户名</div>
<div class="flex-0 text-center w-10 gray">类型</div>
<div class="flex-0 text-center w-20 gray">增值量</div>
<div class="flex-0 text-center w-20 gray">提成</div>
</div>
</div>
</div>
</a>
</div>
<div class="myproperty-achievement-box" style="top: 87px">
<div class="container1-box">
<div>
<mt-loadmore :bottom-method="loadMore" :bottom-all-loaded="allLoaded" ref="loadmore" :auto-fill=false >
<a class="mint-cell" v-for="item in items">
<div class="mint-cell-wrapper">
<div class="mint-cell-title">
<div class="hhxh-flex">
<div class="flex-0 text-center w-25">{{dateFormat(item.bizDate)}}</div>
<div class="flex-0 text-center w-25">{{item.userName}}</div>
<div class="flex-0 text-center w-10">{{item.type}}</div>
<div class="flex-0 text-center w-20">{{item.inreaseAmount}}</div>
<div class="flex-0 text-center w-20">{{item.commission}}</div>
</div>
</div>
</div>
</a>
</mt-loadmore>
</div>
</div>
</div>
<no-data :items="items" :isLoading="isLoading"></no-data>
<!--container end-->
<!--footer-->
<!--fonter end-->
</div>
</template>
<script>
import comHeader from 'components/comHeader'
import noData from 'components/noData'
import mineIncome from '../SERVICES/mineIncome'
export default {
components: {
comHeader,
noData
},
data: () => ({
headerData: {
title: '测试',
toLink: ''
},
isLoading: true,
pageNo: 1,
pageSize: 10,
allLoaded: false,
items: []
}),
created () {
// 组件创建完后获取数据,这里和1.0不一样,改成了这个样子
this.loadList()
},
methods: {
loadList: function () {
let bizDate = sessionStorage.getItem('bizDate')
let startTime = bizDate + ' 00:00:00'
let endTime = bizDate + ' 23:59:59'
mineIncome.loadShareDetail(startTime, endTime, this.pageNo, this.pageSize).then(res => {
this.isLoading = false
let list = res.t
if (list.length === 0) {
// 若数据已全部获取完毕,将绑定到组件bottom-all-loaded属性的变量赋值为true,这样bottom-method就不会再次执行了
this.allLoaded = true
} else if (list.length > 0 && list.length <= this.pageSize) {
for (let i = 0; i <= list.length - 1; i++) {
this.items.push(list[i])
}
if (list.length === this.pageSize) { // 长度达到每页的最大长度,说明后面可能还有数据
this.pageNo += 1
} else { // 没有更多的数据了
this.allLoaded = true
}
}
})
},
loadMore: function () {
// 加载更多数据
this.loadList()
// 在加载数据后需要对组件进行重新定位的操作
this.$refs.loadmore.onBottomLoaded()
},
dateFormat: function (date) {
return window.moment(date).format('YYYY-MM-DD HH:mm:ss')
}
}
}
</script>
<div>
<!--header-->
<com-header :title="headerData.title" :toLink="headerData.toLink"></com-header>
<!--header end-->
<!--container-->
<div>
<a class="mint-cell">
<div class="mint-cell-wrapper">
<div class="mint-cell-title">
<div class="hhxh-flex">
<div class="flex-0 text-center w-25 gray">时间</div>
<div class="flex-0 text-center w-25 gray">用户名</div>
<div class="flex-0 text-center w-10 gray">类型</div>
<div class="flex-0 text-center w-20 gray">增值量</div>
<div class="flex-0 text-center w-20 gray">提成</div>
</div>
</div>
</div>
</a>
</div>
<div class="myproperty-achievement-box" style="top: 87px">
<div class="container1-box">
<div>
<mt-loadmore :bottom-method="loadMore" :bottom-all-loaded="allLoaded" ref="loadmore" :auto-fill=false >
<a class="mint-cell" v-for="item in items">
<div class="mint-cell-wrapper">
<div class="mint-cell-title">
<div class="hhxh-flex">
<div class="flex-0 text-center w-25">{{dateFormat(item.bizDate)}}</div>
<div class="flex-0 text-center w-25">{{item.userName}}</div>
<div class="flex-0 text-center w-10">{{item.type}}</div>
<div class="flex-0 text-center w-20">{{item.inreaseAmount}}</div>
<div class="flex-0 text-center w-20">{{item.commission}}</div>
</div>
</div>
</div>
</a>
</mt-loadmore>
</div>
</div>
</div>
<no-data :items="items" :isLoading="isLoading"></no-data>
<!--container end-->
<!--footer-->
<!--fonter end-->
</div>
</template>
<script>
import comHeader from 'components/comHeader'
import noData from 'components/noData'
import mineIncome from '../SERVICES/mineIncome'
export default {
components: {
comHeader,
noData
},
data: () => ({
headerData: {
title: '测试',
toLink: ''
},
isLoading: true,
pageNo: 1,
pageSize: 10,
allLoaded: false,
items: []
}),
created () {
// 组件创建完后获取数据,这里和1.0不一样,改成了这个样子
this.loadList()
},
methods: {
loadList: function () {
let bizDate = sessionStorage.getItem('bizDate')
let startTime = bizDate + ' 00:00:00'
let endTime = bizDate + ' 23:59:59'
mineIncome.loadShareDetail(startTime, endTime, this.pageNo, this.pageSize).then(res => {
this.isLoading = false
let list = res.t
if (list.length === 0) {
// 若数据已全部获取完毕,将绑定到组件bottom-all-loaded属性的变量赋值为true,这样bottom-method就不会再次执行了
this.allLoaded = true
} else if (list.length > 0 && list.length <= this.pageSize) {
for (let i = 0; i <= list.length - 1; i++) {
this.items.push(list[i])
}
if (list.length === this.pageSize) { // 长度达到每页的最大长度,说明后面可能还有数据
this.pageNo += 1
} else { // 没有更多的数据了
this.allLoaded = true
}
}
})
},
loadMore: function () {
// 加载更多数据
this.loadList()
// 在加载数据后需要对组件进行重新定位的操作
this.$refs.loadmore.onBottomLoaded()
},
dateFormat: function (date) {
return window.moment(date).format('YYYY-MM-DD HH:mm:ss')
}
}
}
</script>
阅读全文
0 0
- vue.js 列表数据加载更多
- vue.js监听滚动条加载更多数据
- vue 列表滑动加载数据
- vue底部加载更多
- vue 2 滚动条加载更多数据实现
- Vue.js Demo 数据及其列表操作
- vue上拉加载更多
- Android列表加载更多数据,并实现点赞
- Vue项目--用iscroll.js+pullToRefresh.js实现上拉加载更多、下拉刷新
- 加载更多JS原理
- js加载更多代码
- js加载更多
- js加载更多
- js分页加载更多
- jquery列表点击加载更多
- 加载更多数据
- 滑动加载更多数据
- vue中实现滚动加载更多
- Opentsdb 2.3 Writing data(二)
- shell中各种括号的作用()、(())、[]、[[]]、{}
- D
- 实验楼Linux基础入门(新版)- 历史命令
- http://www.cnblogs.com/lambertwe/p/5372590.html
- vue.js 列表数据加载更多
- 刷题三
- 51Nod-1166-大数开平方
- vue入门
- 商城项目:maven项目依赖was cached in the local repository错误
- jQuery中this与$(this)的区别
- Android源码编译(四)系统源码目录
- 欢迎使用CSDN-markdown编辑器
- SpringMVC字段验证返回400错误码