Fix pagination confusion

pull/3445/head
johnniang 2019-04-19 00:56:17 +08:00
parent 2120e8aa9e
commit 8976f69415
1 changed files with 9 additions and 8 deletions

View File

@ -64,6 +64,7 @@
<a-row type="flex" justify="end"> <a-row type="flex" justify="end">
<a-pagination <a-pagination
:total="pagination.total" :total="pagination.total"
:defaultPageSize="pagination.size"
:pageSizeOptions="['18', '36', '54']" :pageSizeOptions="['18', '36', '54']"
showSizeChanger showSizeChanger
@change="handlePaginationChange" @change="handlePaginationChange"
@ -191,8 +192,8 @@ export default {
attachments: [], attachments: [],
editable: false, editable: false,
pagination: { pagination: {
current: 1, page: 1,
pageSize: 18, size: 18,
sort: null sort: null
}, },
queryParam: { queryParam: {
@ -208,8 +209,8 @@ export default {
}, },
methods: { methods: {
loadAttachments() { loadAttachments() {
this.queryParam.page = this.pagination.current - 1 this.queryParam.page = this.pagination.page - 1
this.queryParam.size = this.pagination.pageSize this.queryParam.size = this.pagination.size
this.queryParam.sort = this.pagination.sort this.queryParam.sort = this.pagination.sort
attachmentApi.query(this.queryParam).then(response => { attachmentApi.query(this.queryParam).then(response => {
this.attachments = response.data.data.content this.attachments = response.data.data.content
@ -269,10 +270,10 @@ export default {
onChildClose() { onChildClose() {
this.drawerVisible = false this.drawerVisible = false
}, },
handlePaginationChange(page, pageSize) { handlePaginationChange(page, size) {
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`) this.$log.debug(`Current: ${page}, PageSize: ${size}`)
this.pagination.current = page this.pagination.page = page
this.pagination.pageSize = pageSize this.pagination.size = size
this.loadAttachments() this.loadAttachments()
}, },
handleUpload(option) { handleUpload(option) {