Skip to content

Instantly share code, notes, and snippets.

@akosiyawin
Created November 4, 2022 00:42
Show Gist options
  • Save akosiyawin/0451ea71cbcd04c339b12b9e6b81a0fc to your computer and use it in GitHub Desktop.
Save akosiyawin/0451ea71cbcd04c339b12b9e6b81a0fc to your computer and use it in GitHub Desktop.
Pagination for API using Vue.js
<script setup>
import Pagination from "laravel-vue-pagination";
defineProps({
data: {
type: Object,
required: true,
},
getter: {
type: Function,
required: true,
},
});
</script>
<template>
<Pagination :data="data" @pagination-change-page="getter">
<template #prev-nav>
<span>&laquo; Previous</span>
</template>
<template #next-nav>
<span>Next &raquo;</span>
</template>
</Pagination>
</template>
<style>
ul.pagination {
@apply flex gap-1;
}
ul.pagination li.page-item a.page-link {
@apply text-sm py-2 px-4 border rounded;
}
ul.pagination li.page-item.active a.page-link {
@apply bg-primary text-white;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment