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

View File

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

View File

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