|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<div class="report-home" ref="wrapper">
|
|
|
<div v-if="listState.list.length && listState.list.length > 0">
|
|
|
+ <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
|
|
|
<van-list
|
|
|
v-model="listState.loading"
|
|
|
:finished="listState.finished"
|
|
@@ -27,6 +28,7 @@
|
|
|
</li>
|
|
|
</ul>
|
|
|
</van-list>
|
|
|
+ </van-pull-refresh>
|
|
|
</div>
|
|
|
<Empty v-else>
|
|
|
<div class="tip-sub-text">暂无数据</div>
|
|
@@ -36,11 +38,12 @@
|
|
|
<script lang="ts">
|
|
|
import { Component, Vue } from 'vue-property-decorator'
|
|
|
import { mapState, mapMutations, mapActions } from 'vuex'
|
|
|
-import { List } from 'vant'
|
|
|
+import { PullRefresh, List, Toast } from 'vant'
|
|
|
import Empty from '@/components/common/Empty.vue'
|
|
|
@Component({
|
|
|
name: 'home',
|
|
|
components: {
|
|
|
+ [PullRefresh.name]: PullRefresh,
|
|
|
[List.name]: List,
|
|
|
Empty
|
|
|
},
|
|
@@ -49,7 +52,8 @@ import Empty from '@/components/common/Empty.vue'
|
|
|
reportList: (state: any) => state.reportList
|
|
|
}),
|
|
|
...mapMutations({
|
|
|
- saveList: 'home/saveReportList'
|
|
|
+ saveList: 'home/saveReportList',
|
|
|
+ clearList: 'home/clearReportList'
|
|
|
}),
|
|
|
...mapActions({
|
|
|
getList: 'home/getReportList'
|
|
@@ -61,6 +65,8 @@ export default class Home extends Vue {
|
|
|
protected reportList!: any
|
|
|
protected getList!: any
|
|
|
protected saveList!: any
|
|
|
+ protected clearList!: any
|
|
|
+ isLoading = false
|
|
|
listState = {
|
|
|
list: [],
|
|
|
loading: false,
|
|
@@ -140,6 +146,25 @@ export default class Home extends Vue {
|
|
|
goDetail (item) {
|
|
|
this.$router.push(`/detail/${item.id}`)
|
|
|
}
|
|
|
+
|
|
|
+ onRefresh () {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isLoading = false
|
|
|
+ this.clearList()
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.listState = {
|
|
|
+ list: [],
|
|
|
+ loading: false,
|
|
|
+ finished: false,
|
|
|
+ currentPage: 1,
|
|
|
+ totalPage: 0,
|
|
|
+ scroll: 0
|
|
|
+ }
|
|
|
+ this.getReportList()
|
|
|
+ Toast('刷新成功')
|
|
|
+ })
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss">
|