-
Notifications
You must be signed in to change notification settings - Fork 1
Pagination Guide
Karnando Sepryan edited this page Oct 28, 2019
·
5 revisions
This component auto renders total page based on the data provided by api response.
Steps:
- add paging data, this data will be used in the api url
data () {
return {
paging: {
page: 1,
size: 10,
totalRecords: 0
}
}
}
- use this method change page
loadPage (page) {
this.paging.page = page
this.initPage() //this method contains the api call
}
- Initialize the b-pagination component in the .vue
<div class="announcement__pagination-wrapper" v-if="!isLoading">
<b-pagination
:total="paging.totalRecords"
:current.sync="paging.currentPage"
:per-page="paging.size"
@change="loadPage"
range-before="1"
range-after="2"
order="is-centered">
</b-pagination>
</div>