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.

55 lines
1004 B

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