[Vuejs]-How to add pagination in api driven vue app?

0👍

any third-party of pagination api has the property that you should set the current page and the limit or total, the main of pagination is that current page,page size, total and the callback of current page changes, the lifecycle is that:

  1. init: you fetch the api with the params(currentpage, pagesize) to get data, then according to your response ,you can get the total count of your data
  2. use the 1 step response like total count, and give it to your pagination component
  3. don’t forget to declare your onChange callback ,which the pagination component necessary to use, in the callback ,you just change the current page which user click and fetch your api again to get the new data.

Leave a comment