jw-vue-pagination

1.0.3 · abandoned · verified Sun Apr 19

jw-vue-pagination is a Vue.js component designed for client-side pagination, allowing developers to easily split large datasets into manageable pages. As of its latest stable version, 1.0.3, published approximately six years ago (October 2019), the package is not actively maintained. It functions by relying on the separate `jw-paginate` library for its core pagination logic, abstracting the item paging calculations. This component is specifically tailored for Vue 2 applications, as indicated by its release timeline and common usage patterns. While simple and functional for its intended environment, its lack of recent updates means it does not support Vue 3 and may not be suitable for modern Vue projects requiring ongoing maintenance or compatibility with newer ecosystem tooling. Key differentiators include its lightweight nature and a clear separation of UI from pagination logic.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to integrate `jw-vue-pagination` into a basic Vue 2 application, registering it globally and using it to paginate a hardcoded list of items. It highlights passing `items` as a prop and handling `changePage` events.

import Vue from 'vue';
import App from './App.vue';
import JwPagination from 'jw-vue-pagination';

// Globally register the pagination component
Vue.component('jw-pagination', JwPagination);

new Vue({
  el: '#app',
  render: h => h(App)
});

// --- App.vue ---
// <template>
//   <div id="app">
//     <h1>Vue.js Simple Pagination Example</h1>
//     <div class="card m-3">
//       <h5 class="card-header">Example of Paging a List of Items</h5>
//       <div class="card-body">
//         <div v-if="pageOfItems.length">
//           <div v-for="item in pageOfItems" :key="item.id">{{item.name}}</div>
//         </div>
//         <div class="card-footer pb-0 pt-3">
//           <jw-pagination :items="exampleItems" @changePage="onChangePage"></jw-pagination>
//         </div>
//       </div>
//     </div>
//   </div>
// </template>

// <script>
// export default {
//   name: 'App',
//   data() {
//     return {
//       exampleItems: [],
//       pageOfItems: []
//     };
//   },
//   created() {
//     // generate 150 dummy items
//     this.exampleItems = [...Array(150).keys()].map(i => ({ id: (i+1), name: 'Item ' + (i+1) }));
//   },
//   methods: {
//     onChangePage(pageOfItems) {
//       // update current page of items
//       this.pageOfItems = pageOfItems;
//     }
//   }
// };
// </script>

// <style>
// /* Basic styling, not part of jw-vue-pagination package */
// .card {
//   border: 1px solid #eee;
//   border-radius: 4px;
//   box-shadow: 0 2px 4px rgba(0,0,0,0.1);
// }
// .card-header {
//   padding: 10px 15px;
//   border-bottom: 1px solid #eee;
//   font-weight: bold;
//   background-color: #f8f9fa;
// }
// .card-body {
//   padding: 15px;
// }
// .card-footer {
//   padding: 10px 15px;
//   background-color: #f8f9fa;
//   border-top: 1px solid #eee;
// }
// .m-3 {
//   margin: 1rem;
// }
// .pb-0 {
//   padding-bottom: 0 !important;
// }
// .pt-3 {
//   padding-top: 1rem !important;
// }
// </style>

view raw JSON →