fix: resolve admin pages pagination bug (#4280)

This commit is contained in:
tsh96 2021-09-12 04:59:10 +08:00 committed by GitHub
parent d72aad52c0
commit 7e997aada5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,6 +61,7 @@
sort-by='updatedAt', sort-by='updatedAt',
sort-desc, sort-desc,
hide-default-footer hide-default-footer
@page-count="pageTotal = $event"
) )
template(slot='item', slot-scope='props') template(slot='item', slot-scope='props')
tr.is-clickable(:active='props.selected', @click='$router.push(`/pages/` + props.item.id)') tr.is-clickable(:active='props.selected', @click='$router.push(`/pages/` + props.item.id)')
@ -89,6 +90,7 @@ export default {
selectedPage: {}, selectedPage: {},
pagination: 1, pagination: 1,
pages: [], pages: [],
pageTotal: 0,
headers: [ headers: [
{ text: 'ID', value: 'id', width: 80, sortable: true }, { text: 'ID', value: 'id', width: 80, sortable: true },
{ text: 'Title', value: 'title' }, { text: 'Title', value: 'title' },
@ -108,9 +110,6 @@ export default {
} }
}, },
computed: { computed: {
pageTotal () {
return Math.ceil(this.filteredPages.length / 15)
},
filteredPages () { filteredPages () {
return _.filter(this.pages, pg => { return _.filter(this.pages, pg => {
if (this.selectedLang !== null && this.selectedLang !== pg.locale) { if (this.selectedLang !== null && this.selectedLang !== pg.locale) {