├── .gitignore
├── ISSUE_TEMPLATE.md
├── LICENSE
├── README.md
├── dist
└── vue-pagination.min.js
├── index.js
├── package.json
└── src
└── template.html
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | - Vue.js version:
2 | - consumed using: (browserify/webpack/pre-compiled)
3 | - FULL error message (including stack trace):
4 | - relevant code:
5 | - steps for reproducing the issue:
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Matanya
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Vue Pagination
2 |
3 | Note: This package is for use with Vuejs 1.
4 | For version 2 please use [vue-pagination-2](https://www.npmjs.com/package/vue-pagination-2) instead.
5 |
6 | Simple, generic and non-intrusive pagination component for Vue.js.
7 | Presentation is based on bootstrap.
8 |
9 | - [Dependencies](#dependencies)
10 | - [Installation](#installation)
11 | - [Usage](#usage)
12 | - [Programmatic Manipulation](#programmatic-manipulation)
13 | - [Computed Properties](#computed-properties)
14 |
15 | # Dependencies
16 |
17 | * Vue.js (>=1.0). Required.
18 | * Bootstrap (CSS). Optional.
19 |
20 | # Installation
21 |
22 | ## Option 1
23 |
24 | Compile the code using `browserify` with the `stringify` transform
25 |
26 | npm install v-pagination
27 |
28 | Require the script:
29 |
30 | var VuePagination = require('v-pagination');
31 |
32 | ## Option 2
33 |
34 | Import the [compiled standalone file](https://raw.githubusercontent.com/matfish2/vue-pagination/master/dist/vue-pagination.min.js) into your HTML, which will expose a global `VuePagination` variable.
35 |
36 | # Usage
37 |
38 | [LIVE DEMO](https://jsfiddle.net/matfish2/rnw8jjs3/)
39 |
40 | ## Register the component
41 |
42 | Vue.use(VuePagination)
43 |
44 | HTML:
45 |
46 |
47 |
48 | props:
49 |
50 | * `for` `string` `required` unique identifier for the component instance.
51 | * `records` `number` `required` number of records
52 | * `per-page` `number` `optional` records per page. Default: 25
53 | * `chunk` `number` `optional` max pages per chunk. Default: 10
54 | * `count-text` `string` `optional` total records text. Default: '{count} records'
55 |
56 | When a page is selected an event will be dispatched, using the unique id for the component.
57 | Listen to it and respond accordingly:
58 |
59 | this.$on('vue-pagination::some-entity', function(page) {
60 | // display the relevant records using the page param
61 | });
62 |
63 | # Programmatic Manipulation
64 |
65 | To programmatically set the page apply a `v-ref` identifier to the component and use one of the following methods:
66 |
67 | * `setPage(page)`
68 | * `next()`
69 | * `prev()`
70 | * `nextChunk()`
71 | * `prevChunk()`
72 |
73 | All methods return `true` if the page is legal and was thus set, or `false` otherwise.
74 |
75 | # Computed Properties
76 |
77 | * `totalPages`
78 | * `totalChunks`
79 | * `currentChunk`
80 |
81 |
--------------------------------------------------------------------------------
/dist/vue-pagination.min.js:
--------------------------------------------------------------------------------
1 | !function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.VuePagination=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o