Skip to content

Commit bdb632d

Browse files
author
Vinayak Kulkarni
committed
💯 Travis, README & package.json
1 parent 04f1a26 commit bdb632d

File tree

4 files changed

+5283
-0
lines changed

4 files changed

+5283
-0
lines changed

README.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
[![Build Status](https://travis-ci.org/vinayakkulkarni/laravel-vue-semantic-ui-pagination.svg?branch=master)](https://travis-ci.org/vinayakkulkarni/laravel-vue-semantic-ui-pagination)
2+
3+
# Laravel Vue Semantic-UI Pagination :zap:
4+
+ A Vue.js pagination component for Laravel paginators that works with Semantic-UI.
5+
6+
+ This is [on GitHub](https://github.com/vinayakkulkarni/laravel-vue-semantic-ui-pagination) so let me know if I've b0rked it somewhere, give me a star :star: if you like it :beers:
7+
8+
+ You can checkout the [Demo](https://goo.gl/xtZGF9)
9+
10+
## Requirements
11+
12+
* [Vue.js](https://vuejs.org/) 2.x
13+
* [Laravel](https://laravel.com/docs/) 5.x
14+
* [Semantic-UI](https://semantic-ui.com/) 2.x
15+
16+
## :white_check_mark: Install :ok_hand:
17+
18+
```bash
19+
npm install laravel-vue-semantic-ui-pagination
20+
// or
21+
yarn add laravel-vue-semantic-ui-pagination
22+
```
23+
24+
## :white_check_mark: Usage :mortar_board:
25+
26+
Register the component globally:
27+
```javascript
28+
Vue.component('pagination', require('laravel-vue-pagination'));
29+
```
30+
Or use locally
31+
```javascript
32+
import pagination from 'laravel-vue-semantic-ui-pagination';
33+
```
34+
35+
## :white_check_mark: Example :four_leaf_clover:
36+
37+
```html
38+
<ul>
39+
<li v-for="post in laravelData.data" v-text="post.title"></li>
40+
</ul>
41+
<pagination :data="laravelData" v-bind:showDisabled="true" icon="chevron" v-on:change-page="getResults"></pagination>
42+
```
43+
44+
```javascript
45+
Vue.component('example-component', {
46+
47+
data() {
48+
return {
49+
// Our data object that holds the Laravel paginator data
50+
laravelData: {},
51+
}
52+
},
53+
54+
created() {
55+
// Fetch initial results
56+
this.getResults();
57+
},
58+
59+
methods: {
60+
// Our method to GET results from a Laravel endpoint
61+
getResults(page) {
62+
if (typeof page === 'undefined') {
63+
page = 1;
64+
}
65+
66+
// Using vue-resource as an example
67+
this.$http.get('example/results?page=' + page)
68+
.then(response => {
69+
return response.json();
70+
}).then(data => {
71+
this.laravelData = data;
72+
});
73+
}
74+
}
75+
76+
});
77+
```
78+
79+
### :white_check_mark: :book: Props
80+
81+
| Name | Type | Description |
82+
| --- | --- | --- |
83+
| `data` | Object | An object containing the structure of a [Laravel paginator](https://laravel.com/docs/5.4/pagination) response. See below for default value. |
84+
| `limit` | Number | (optional) Limit of pages to be rendered. Default `0` (unlimited links) `-1` will hide numeric pages and leave only arrow navigation. `3` will show 3 previous and 3 next numeric pages from current page. |
85+
| `showDisabled` | Boolean | (optional) If set to true, will display left and right icons always. |
86+
| `icon` | String | (optional) Default is `angle double`; Refer [Semantic-UI Icons](https://semantic-ui.com/elements/icon.html) for specifying which icons you want. |
87+
| `size` | String | (optional) Default is `small`; Refer [Semantic-UI Menu Pagination](https://semantic-ui.com/collections/menu.html#pagination) for specifying the size of paginator. |
88+
89+
```javascript
90+
{
91+
current_page: 1,
92+
data: [],
93+
from: 1,
94+
last_page: 1,
95+
next_page_url: null,
96+
per_page: 10,
97+
prev_page_url: null,
98+
to: 1,
99+
total: 0,
100+
}
101+
```
102+
103+
### :white_check_mark: :ear: Events
104+
105+
| Name | Description |
106+
| --- | --- |
107+
| `change-page` | Triggered when a user changes page. Passes the new `page` index as a parameter. |
108+
109+
110+
## NPM :octocat:
111+
112+
[![NPM](https://nodei.co/npm/laravel-vue-semantic-ui-pagination.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/laravel-vue-semantic-ui-pagination/)

0 commit comments

Comments
 (0)