LaunchStack provides a default pagination component, 100% compatible with Laravel, Vue, and Inertiajs.
class BlogController extends Controller
{
public function home()
{
return Inertia::render('Blog/Home', [
'posts' => BlogPost::published()->latest()->paginate(12)
]);
}
}
# resources/js/Components/Pagination.vue
<script setup>
import Pagination from "@/Components/Pagination.vue";
const { posts } = defineProps({
posts: Object,
});
</script>
<template>
<div v-for="post in posts" :key="post">
{{ post.title }}
</div>
<Pagination :data="posts" />
</template>
<Pagination :data="posts" style="table" />