Created
November 4, 2022 00:42
-
-
Save akosiyawin/0451ea71cbcd04c339b12b9e6b81a0fc to your computer and use it in GitHub Desktop.
Pagination for API using Vue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>« Previous</span> | |
</template> | |
<template #next-nav> | |
<span>Next »</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