commit | author | age
|
aab811
|
1 |
<template> |
I |
2 |
<div> |
|
3 |
<div v-infinite-scroll="loadMore" infinite-scroll-disabled="busy" :infinite-scroll-distance="10"> |
|
4 |
<div v-for="temp in data"> |
06ee76
|
5 |
<newArticle></newArticle> |
aab811
|
6 |
<box5 v-bind="temp"></box5> |
I |
7 |
</div> |
|
8 |
<div v-if="loading && !busy" class="demo-loading-container"> |
|
9 |
<a-spin /> |
|
10 |
</div> |
|
11 |
</div> |
019990
|
12 |
<a-row type="flex" justify="center"> |
I |
13 |
<div style="position:fixed;bottom: 10px;" id="dddadf"> |
|
14 |
<a-pagination @change="onChange" :showQuickJumper="true" :size="size" v-model="current" |
|
15 |
:defaultPageSize="pageSize" :total="total" /> |
|
16 |
</div> |
|
17 |
</a-row> |
b505f3
|
18 |
|
aab811
|
19 |
</div> |
I |
20 |
</template> |
|
21 |
<script> |
|
22 |
import infiniteScroll from 'vue-infinite-scroll'; |
|
23 |
import box5 from "../mini/box5-article.vue" |
|
24 |
import babyActicle from '../../assets/baby.htm' |
06ee76
|
25 |
import newArticle from "../mini/box-new-article.vue" |
aab811
|
26 |
import shijie from '../../assets/shijie.htm' |
I |
27 |
|
|
28 |
var obj1 = { |
|
29 |
"source": babyActicle, |
|
30 |
"title": "陈奕迅-Body Song 歌词", |
|
31 |
"read": 1101, |
|
32 |
"like": 233, |
|
33 |
"folder": "歌词", |
|
34 |
"publishTime": "2021-05-26", |
|
35 |
} |
|
36 |
var obj2 = { |
|
37 |
"source": shijie, |
|
38 |
"title": "这世界那么多人-吉他谱", |
|
39 |
"read": 3101, |
|
40 |
"like": 113, |
|
41 |
"folder": "吉他谱", |
|
42 |
"publishTime": "2020-05-26", |
|
43 |
} |
|
44 |
var obj3 = { |
|
45 |
"source": shijie, |
|
46 |
"title": "遥远的它-吉他谱", |
|
47 |
"read": 201, |
|
48 |
"like": 13, |
|
49 |
"folder": "吉他谱", |
|
50 |
"publishTime": "2022-07-26", |
|
51 |
} |
|
52 |
|
|
53 |
export default { |
|
54 |
components: { |
06ee76
|
55 |
box5, |
L |
56 |
newArticle |
aab811
|
57 |
}, |
I |
58 |
directives: { |
|
59 |
infiniteScroll |
|
60 |
}, |
|
61 |
data() { |
|
62 |
return { |
|
63 |
|
|
64 |
data: [], |
|
65 |
loading: false, |
|
66 |
busy: false, |
|
67 |
size: "small", |
|
68 |
total: 500, |
|
69 |
pageSize: 20, |
|
70 |
current: 1, |
|
71 |
}; |
|
72 |
}, |
|
73 |
beforeMount() { |
019990
|
74 |
this.data = [obj1, obj2,obj3,obj2]; |
aab811
|
75 |
}, |
I |
76 |
methods: { |
|
77 |
onChange(current) { |
|
78 |
this.current = current; |
|
79 |
this.data = [obj2, obj3, obj1, obj2]; |
|
80 |
}, |
|
81 |
loadMore() { |
|
82 |
const data = this.data; |
|
83 |
this.loading = true; |
|
84 |
|
|
85 |
this.current += 1; |
|
86 |
console.log(this.current); |
|
87 |
console.log(this.busy); |
|
88 |
|
b505f3
|
89 |
if (data.length > 3) { |
aab811
|
90 |
this.$message.warning('没有更多了'); |
I |
91 |
this.busy = true; |
|
92 |
this.loading = false; |
|
93 |
return; |
|
94 |
} |
|
95 |
|
|
96 |
|
|
97 |
setTimeout(function() { |
|
98 |
this.loading = false; |
|
99 |
}, 1000); |
|
100 |
|
|
101 |
this.data = data.concat(obj1, obj3, obj2, obj3, obj1); |
|
102 |
|
|
103 |
}, |
|
104 |
}, |
|
105 |
}; |
|
106 |
</script> |
|
107 |
<style> |
|
108 |
/* .test { |
|
109 |
overflow: hidden; |
|
110 |
height: 700px; |
|
111 |
} |
|
112 |
|
|
113 |
.infinite-container { |
|
114 |
overflow: auto; |
|
115 |
} |
|
116 |
|
|
117 |
.infinite-container::-webkit-scrollbar { |
|
118 |
display: none; |
|
119 |
} */ |
|
120 |
|
|
121 |
.demo-loading-container { |
|
122 |
position: absolute; |
|
123 |
bottom: 40px; |
|
124 |
width: 100%; |
|
125 |
text-align: center; |
|
126 |
} |
|
127 |
</style> |