sorting by rank + pagination

This commit is contained in:
hamdy
2020-11-13 14:09:21 +02:00
parent 79e935346e
commit f01f9ba667
3 changed files with 56 additions and 9 deletions

View File

@@ -9,6 +9,15 @@
/>
</div>
</div>
<div class="pagination flex justify-center mb-8">
<Pagination
:baseUrl="baseurl"
:currentPage="$page.entries.pageInfo.currentPage"
:totalPages="$page.entries.pageInfo.totalPages"
:maxVisibleButtons="5"
v-if="$page.entries.pageInfo.totalPages > 1"
/>
</div>
</Layout>
</template>
@@ -16,7 +25,7 @@
query($page:Int) {
entries: allBlog(perPage: 9, page: $page) @paginate {
entries: allBlog(perPage: 10, page: $page, sortBy: "created", order: DESC) @paginate {
totalCount
pageInfo {
totalPages
@@ -49,6 +58,7 @@ query($page:Int) {
<script>
import PostListItem from "~/components/PostListItem.vue";
import Pagination from "~/components/Pagination.vue";
export default {
metaInfo: {
@@ -56,6 +66,12 @@ export default {
},
components: {
PostListItem,
Pagination
},
computed: {
baseurl: function() {
return ""
}
},
};
</script>