You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.1 KiB

2 years ago
2 years ago
2 years ago
  1. <template>
  2. <v-bottom-navigation app absolute hide-on-scroll>
  3. <v-btn :disabled="isFirstPage" @click="updatePage(page - 1)">
  4. <span>Prev</span>
  5. <v-icon>{{ mdiChevronLeft }}</v-icon>
  6. </v-btn>
  7. <v-btn :disabled="isLastPage" @click="updatePage(page + 1)">
  8. <span>Next</span>
  9. <v-icon>{{ mdiChevronRight }}</v-icon>
  10. </v-btn>
  11. </v-bottom-navigation>
  12. </template>
  13. <script lang="ts">
  14. import Vue from 'vue'
  15. import { mdiChevronLeft, mdiChevronRight } from '@mdi/js'
  16. export default Vue.extend({
  17. props: {
  18. total: {
  19. type: Number,
  20. default: 1,
  21. required: true
  22. }
  23. },
  24. data() {
  25. return {
  26. mdiChevronLeft,
  27. mdiChevronRight
  28. }
  29. },
  30. computed: {
  31. page(): number {
  32. // @ts-ignore
  33. return parseInt(this.$route.query.page, 10)
  34. },
  35. isFirstPage(): boolean {
  36. return this.page === 1
  37. },
  38. isLastPage(): boolean {
  39. return this.page === this.total || this.total === 0
  40. }
  41. },
  42. methods: {
  43. updatePage(page: number) {
  44. this.$router.push({ query: { page: page.toString() } })
  45. }
  46. }
  47. })
  48. </script>