knubbe's avatar
Level 36

Nuxt 3 pagination with Laravel API

I am trying to implement basic pagination in Nuxt 3 app but I can't solve reactivity on next and previous button. What can be the best possible way to implement that functionality? This is what I have:

<script setup>
import { UserCircleIcon, ArrowNarrowLeftIcon, ArrowNarrowRightIcon } from "@heroicons/vue/solid";
import { ref } from "vue";

const page = ref(1)

const patients = await useNuxtApp().$apiFetch(`/api/patients?page=${page.value}`)

function nextPage() {
  page.value++
}

definePageMeta({
  layout: "master",
});
</script>

I only have Next and Previous buttons as pagination and response is from Laravel APP via Json Resources class

0 likes
0 replies

Please or to participate in this conversation.