Implement pagination properly
This commit is contained in:
parent
a0fcb669bd
commit
1ded5a4bb2
@ -25,7 +25,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-if="paginate"
|
v-if="paginate && !loading"
|
||||||
v-model:page="page"
|
v-model:page="page"
|
||||||
v-model:itemsPerPage="itemsPerPage"
|
v-model:itemsPerPage="itemsPerPage"
|
||||||
:max-pages="lastPage"
|
:max-pages="lastPage"
|
||||||
@ -88,6 +88,7 @@ export default {
|
|||||||
this.$router.push({ name: 'blog-article', params: { year, month, day, id, slug }});
|
this.$router.push({ name: 'blog-article', params: { year, month, day, id, slug }});
|
||||||
},
|
},
|
||||||
updateList(limit, page) {
|
updateList(limit, page) {
|
||||||
|
this.loading = true;
|
||||||
axios.get("/api/blog/recent", {
|
axios.get("/api/blog/recent", {
|
||||||
params: {
|
params: {
|
||||||
limit: limit,
|
limit: limit,
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<button @click="gotoPage(0)">First</button>
|
<div class="pagination">
|
||||||
<button @click="gotoPage(page - 1)">Previous</button>
|
<button @click="gotoPage(0)">First</button>
|
||||||
<span>{{ page + 1 }} / {{ maxPages }}</span>
|
<button @click="gotoPage(page - 1)">Previous</button>
|
||||||
<button @click="gotoPage(page + 1)">Next</button>
|
<button class="unselectable">{{ page + 1 }} / {{ maxPages }}</button>
|
||||||
<button @click="gotoPage(maxPages)">Last</button>
|
<button @click="gotoPage(page + 1)">Next</button>
|
||||||
|
<button @click="gotoPage(maxPages)">Last</button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
37
resources/scss/_pagination.scss
vendored
Normal file
37
resources/scss/_pagination.scss
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
.pagination {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: #1c2d35;
|
||||||
|
border: 1px solid white;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
height: 40px;
|
||||||
|
width: 120px;
|
||||||
|
padding: .5rem;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:not(.unselectable) {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:not(.unselectable):hover {
|
||||||
|
background-color: #2d3e46;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:not(:last-child) {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:first-child {
|
||||||
|
border-top-left-radius: 15px;
|
||||||
|
border-bottom-left-radius: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:last-child {
|
||||||
|
border-top-right-radius: 15px;
|
||||||
|
border-bottom-right-radius: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
resources/scss/app.scss
vendored
1
resources/scss/app.scss
vendored
@ -16,3 +16,4 @@
|
|||||||
@import "blog";
|
@import "blog";
|
||||||
@import "footer";
|
@import "footer";
|
||||||
@import "home";
|
@import "home";
|
||||||
|
@import "pagination";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user