Skip to content

Commit d5529b8

Browse files
author
reco_luan
committed
fix: pagation
1 parent 70e615d commit d5529b8

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

components/Pagation.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ export default {
2323
}
2424
},
2525
props: {
26-
data: {
27-
type: Array,
28-
default () {
29-
return []
30-
}
26+
total: {
27+
type: Number,
28+
default: 10
3129
},
3230
perPage: {
3331
type: Number,
@@ -40,7 +38,7 @@ export default {
4038
},
4139
computed:{
4240
pages () {
43-
return Math.ceil(this.data.length / this.perPage)
41+
return Math.ceil(this.total / this.perPage)
4442
},
4543
show:function(){
4644
return this.pages && this.pages !=1

layouts/Category.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<!-- 分页 -->
2727
<pagation
2828
class="pagation"
29-
:data="posts"
29+
:total="posts.length"
3030
:currentPage="currentPage"
3131
@getCurrentPage="getCurrentPage"></pagation>
3232
</Common>

layouts/Tags.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<pagation
2020
class="pagation"
21-
:data="posts"
21+
:total="posts.length"
2222
:currentPage="currentPage"
2323
@getCurrentPage="getCurrentPage"></pagation>
2424
</div>

0 commit comments

Comments
 (0)