|
| 1 | +<p align="center"> |
| 2 | + <a href="#"><img src="logotype.png" width="380"></a> |
| 3 | + <h4 align="center">A Vue component for create a tiny pagination with Flexbox</h4> |
| 4 | +</p> |
| 5 | + |
| 6 | +<p align="center"> |
| 7 | + <a href="https://npmjs.com/package/vue-tiny-pagination"><img src="https://img.shields.io/npm/dt/vue-tiny-pagination.svg?style=flat-square"></a> |
| 8 | + <a href="https://github.com/coderdiaz/vue-tiny-pagination/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square"></a> |
| 9 | + <a href="https://github.com/coderdiaz/vue-tiny-pagination/stargazers"><img src="https://img.shields.io/github/stars/coderdiaz/vue-tiny-pagination.svg?style=flat-square"></a> |
| 10 | + <a href="http://npmjs.com/package/vue-tiny-pagination"><img src="https://img.shields.io/npm/v/vue-tiny-pagination.svg?style=flat-square"></a> |
| 11 | + <a href="http://npmjs.com/package/vue-tiny-pagination"><img src="https://img.shields.io/npm/dm/vue-tiny-pagination.svg?style=flat-square"></a> |
| 12 | + <a href="https://travis-ci.org/coderdiaz/vue-tiny-pagination"><img src="https://travis-ci.org/coderdiaz/vue-tiny-pagination.svg?branch=master&style=flat-square"></a> |
| 13 | +</p> |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## Install/Usage |
| 18 | +<!-- Replace the docs for usage the plugin --> |
| 19 | +```sh |
| 20 | +# Install with npm |
| 21 | +$ npm i -S vue-tiny-pagination |
| 22 | + |
| 23 | +# or yarn |
| 24 | +$ yarn add vue-tiny-pagination |
| 25 | +``` |
| 26 | + |
| 27 | +```html |
| 28 | +<div id="app"> |
| 29 | + <tiny-pagination |
| 30 | + :total="currentTotal" |
| 31 | + @tiny:change-page="changePage" /> |
| 32 | +</div> |
| 33 | +``` |
| 34 | + |
| 35 | +You can use **Local Registration**: |
| 36 | +```js |
| 37 | +import { TinyPagination } from 'vue-tiny-pagination'; |
| 38 | +new Vue({ |
| 39 | + el: '#app', |
| 40 | + data() { |
| 41 | + return { |
| 42 | + currentTotal: 100, |
| 43 | + currentPage: 1, |
| 44 | + }; |
| 45 | + }, |
| 46 | + methods: { |
| 47 | + changePage (pagination) { |
| 48 | + this.currentPage = pagination.page; |
| 49 | + }, |
| 50 | + }, |
| 51 | + components: { |
| 52 | + TinyPagination, |
| 53 | + }, |
| 54 | +}); |
| 55 | +``` |
| 56 | + |
| 57 | +or **Global Registration**: |
| 58 | +```js |
| 59 | +import TinyPagination from 'vue-tiny-pagination'; |
| 60 | +Vue.use(TinyPagination); |
| 61 | + |
| 62 | +// or with a custom component name |
| 63 | +import { TinyPagination } from 'vue-tiny-pagination'; |
| 64 | +Vue.component('custom-hello-world', TinyPagination); |
| 65 | +``` |
| 66 | + |
| 67 | +### Usage in browser |
| 68 | +<!-- Write an example for use the plugin in browser from CDN --> |
| 69 | +In browser you can use Unpkg, Jsdelivr, CDN.js, etc. |
| 70 | +```sh |
| 71 | +# Unpkg |
| 72 | +https://unpkg.com/vue-tiny-pagination@latest/dist/vue-tiny-pagination.js |
| 73 | + |
| 74 | +# JSDelivr |
| 75 | +https://cdn.jsdelivr.net/npm/vue-tiny-pagination@latest/dist/vue-tiny-pagination.min.js |
| 76 | +``` |
| 77 | + |
| 78 | +## Documentation |
| 79 | +<!-- Add all documentation about the plugin: props, events, etc --> |
| 80 | +### Props |
| 81 | +|Name|Description|Type|Default|Required| |
| 82 | +|---|---|---|---|---| |
| 83 | +|total|A number of total items|Number|-|true| |
| 84 | +|page|Prop to set a default page|Number|1|false| |
| 85 | +|lang|Default language to show (Available: en, es)|String|en|false| |
| 86 | +|customClass|Prop to set a custom class.|String|""|false| |
| 87 | +|limits|Prop to set a default limits to page sizes.|Array|[10, 15, 20,50,100]|false| |
| 88 | +|showLimit|Prop to disable the limit selector|Boolean|true|false| |
| 89 | + |
| 90 | +### Events |
| 91 | +|Event|Description| |
| 92 | +|---|---| |
| 93 | +|tiny:change-page|Get the current page from pagination `payload: { page: 1 }`| |
| 94 | +|tiny:change-limit|Get the current limit from pagination `payload: { limit: 1 }`| |
| 95 | + |
| 96 | +## Community |
| 97 | +All feedback and suggestions are welcome! |
| 98 | + |
| 99 | +## License |
| 100 | +This is a open-source software licensed under the [MIT license](https://raw.githubusercontent.com/coderdiaz/vue-tiny-pagination/master/LICENSE) |
0 commit comments