[Vuejs]-How to create vuejs unsplash pagination?

0👍

ok i find the Solution.
this.pagination = response.headers.link.split(", ");
so it will create array from the string. now you can loop that array and find single link from this with rel=name

<span class="red" v-for="pagi in pagination" v-bind:key="pagi.id">
      <button
        v-if="pagi.includes('first')"
        class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 px-4 border border-gray-400 rounded shadow mr-3"
        v-on:click="fetchPaginateNews(pagi.split('; ')[0])"
      >First</button>
      <button
        v-if="pagi.includes('next')"
        class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 px-4 border border-gray-400 rounded shadow mr-3"
        v-on:click="fetchPaginateNews(pagi.split('; ')[0])"
      >Next</button>
      <button
        v-if="pagi.includes('prev')"
        class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 px-4 border border-gray-400 rounded shadow mr-3"
        v-on:click="fetchPaginateNews(pagi.split('; ')[0])"
      >Prevous</button>
      <button
        v-if="pagi.includes('last')"
        class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 px-4 border border-gray-400 rounded shadow mr-3"
        v-on:click="fetchPaginateNews(pagi.split('; ')[0])"
      >Last</button>

Leave a comment