andrewjroberts's avatar

VueJS & Pagination

Has anyone had any experience with implementing pagination with VueJS? As their seems to be no plugins available for pagination yet, I was wondering what the best approach to take would be.

0 likes
5 replies
ably's avatar

I suppose it would be better to paginate your input data (json from api) and pass page number via Vue. For example let's say you have a post model and you wanna paginate the results, so you get posts from your api /api/posts/list (first page) and add the parameter to uri like /api/posts/list?page=2. Then you grab json data and serve it with Vue. I've never done it before but I would start with this :)

3 likes
andrewjroberts's avatar

I already have the pagination setup via api, I was thinking managing the page navigation via pagination controls. Thanks for your input though :)

ably's avatar

Yes, but you can make for example a vue method called addPageNumer and execute it when clicking on "next Page button". Then you update ajax request and grab new data

2 likes
ratiw's avatar

You can also look at what I've implemented in the vuetable component, which also has a pagination component inside.

Please or to participate in this conversation.