Selaa lähdekoodia

fix: resolve admin pages pagination bug (#4280)

tsh96 3 vuotta sitten
vanhempi
sitoutus
7e997aada5
1 muutettua tiedostoa jossa 2 lisäystä ja 3 poistoa
  1. 2 3
      client/components/admin/admin-pages.vue

+ 2 - 3
client/components/admin/admin-pages.vue

@@ -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) {