N
Nuxt4mo ago
Milo

How to do the JSON API pagination in Nuxt

how can I return the JSON file to user with the pagination query? Right now, I just retrieve all data and return to user in 1 page. I would like to know how to limit it per page and how to go from page 1 to another page.
1 Reply
Single
Single4mo ago
You have two options: 1. Add your own pagination to the received result 2. Add server-side pagination You should definetly use option two if possible, as it keeps you from transfering more data than needed. Two achieve option 1, you could use a View from a framework that does already support pagination (eg: https://primevue.org/datatable/#pagination). In case you want to build it into your own view, vueuse can help: https://vueuse.org/core/useOffsetPagination/
VueUse
Collection of essential Vue Composition Utilities
PrimeVue | Vue UI Component Library
The ultimate collection of design-agnostic, flexible and accessible Vue UI Components.
Want results from more Discord servers?
Add your server