fix: pagation

This commit is contained in:
reco_luan 2019-09-18 19:39:04 +08:00
parent 70e615df59
commit d5529b87c4
3 changed files with 6 additions and 8 deletions

View File

@ -23,11 +23,9 @@ export default {
}
},
props: {
data: {
type: Array,
default () {
return []
}
total: {
type: Number,
default: 10
},
perPage: {
type: Number,
@ -40,7 +38,7 @@ export default {
},
computed:{
pages () {
return Math.ceil(this.data.length / this.perPage)
return Math.ceil(this.total / this.perPage)
},
show:function(){
return this.pages && this.pages !=1

View File

@ -26,7 +26,7 @@
<!-- 分页 -->
<pagation
class="pagation"
:data="posts"
:total="posts.length"
:currentPage="currentPage"
@getCurrentPage="getCurrentPage"></pagation>
</Common>

View File

@ -18,7 +18,7 @@
<pagation
class="pagation"
:data="posts"
:total="posts.length"
:currentPage="currentPage"
@getCurrentPage="getCurrentPage"></pagation>
</div>