Skip to content

Commit 4bf40a8

Browse files
authored
Merge pull request #147 from gilbitron/v4
V4
2 parents eb81a75 + 341110a commit 4bf40a8

38 files changed

+3159
-2649
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ dist-ssr
1616
!.vscode/extensions.json
1717
!.vscode/settings.json
1818
.idea
19+
.temp
20+
.cache
1921
.DS_Store
2022
*.suo
2123
*.ntvs*
@@ -24,3 +26,4 @@ dist-ssr
2426
*.sw?
2527

2628
/app
29+
/dist

README.md

Lines changed: 12 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,37 @@
1-
[![npm](https://img.shields.io/npm/v/laravel-vue-pagination.svg)](https://www.npmjs.com/package/laravel-vue-pagination) [![Downloads](https://img.shields.io/npm/dt/laravel-vue-pagination.svg)](https://www.npmjs.com/package/laravel-vue-pagination)
1+
[![npm](https://img.shields.io/npm/v/laravel-vue-pagination.svg)](https://www.npmjs.com/package/laravel-vue-pagination) [![Downloads](https://img.shields.io/npm/dt/laravel-vue-pagination.svg)](https://www.npmjs.com/package/laravel-vue-pagination) [![Run tests](https://github.com/gilbitron/laravel-vue-pagination/actions/workflows/tests.yml/badge.svg)](https://github.com/gilbitron/laravel-vue-pagination/actions/workflows/tests.yml)
22

33
> Want your logo here? [Sponsor me on GitHub](https://github.com/users/gilbitron/sponsorship)
44
55
# Laravel Vue Pagination
66

7-
A Vue.js pagination component for Laravel paginators.
7+
Laravel Vue Pagination is a Vue.js pagination component for Laravel. It provides out-of-the-box components for Bootstrap 4/5 and Tailwind CSS.
88

9-
## Requirements
9+
## Documentation
1010

11-
* [Vue.js](https://vuejs.org/) 3
12-
* [Laravel](http://laravel.com/docs/) 5+
13-
* [Bootstrap](http://getbootstrap.com/) 4
11+
Complete documentation and demo available at [https://laravel-vue-pagination.org](https://laravel-vue-pagination.org).
1412

15-
For Vue 2 support use [v2](https://github.com/gilbitron/laravel-vue-pagination/releases/tag/2.3.2).
16-
17-
## Install
18-
19-
```bash
20-
npm install laravel-vue-pagination
21-
// or
22-
yarn add laravel-vue-pagination
23-
```
24-
25-
## Usage
26-
27-
Register the component:
28-
29-
```javascript
30-
import LaravelVuePagination from 'laravel-vue-pagination';
31-
32-
export default {
33-
components: {
34-
'Pagination': LaravelVuePagination
35-
}
36-
}
37-
```
38-
39-
Use the component:
40-
41-
```html
42-
<ul>
43-
<li v-for="post in laravelData.data" :key="post.id">{{ post.title }}</li>
44-
</ul>
45-
46-
<Pagination :data="laravelData" @pagination-change-page="getResults" />
47-
```
48-
49-
```javascript
50-
export default {
51-
data() {
52-
return {
53-
// Our data object that holds the Laravel paginator data
54-
laravelData: {},
55-
}
56-
},
57-
58-
mounted() {
59-
// Fetch initial results
60-
this.getResults();
61-
},
62-
63-
methods: {
64-
// Our method to GET results from a Laravel endpoint
65-
getResults(page = 1) {
66-
axios.get('example/results?page=' + page)
67-
.then(response => {
68-
this.laravelData = response.data;
69-
});
70-
}
71-
}
72-
73-
}
74-
```
75-
76-
### Customizing Prev/Next Buttons
77-
78-
Prev/Next buttons can be customized using the `prev-nav` and `next-nav` slots:
79-
80-
```html
81-
<pagination :data="laravelData">
82-
<template #prev-nav>
83-
<span>&lt; Previous</span>
84-
</template>
85-
<template #next-nav>
86-
<span>Next &gt;</span>
87-
</template>
88-
</pagination>
89-
```
90-
91-
## API
92-
93-
### Props
94-
95-
| Name | Type | Description |
96-
| --- | --- | --- |
97-
| `data` | Object | An object containing the structure of a [Laravel paginator](https://laravel.com/docs/8.x/pagination) response or a [Laravel API Resource](https://laravel.com/docs/8.x/eloquent-resources) response. |
98-
| `limit` | Number | (optional) Limit of pages to be rendered. `0` shows all pages (default). `-1` will hide numeric pages and leave only arrow navigation. Any positive integer (e.g. `2`) will define how many pages should be shown on either side of the current page when only a range of pages are shown. |
99-
| `show-disabled` | Boolean | (optional) Show disabled prev/next buttons instead of hiding them. `false` hides disabled buttons (default). `true` shows disables buttons. |
100-
| `size` | String | (optional) One of `small`, `default` or `large` |
101-
| `align` | String | (optional) One of `left` (default), `center` or `right` |
13+
## Show your Support
10214

103-
### Events
15+
To show your support for my work on this project:
10416

105-
| Name | Description |
106-
| --- | --- |
107-
| `pagination-change-page` | Triggered when a user changes page. Passes the new `page` index as a parameter. |
17+
* [Star this repository](https://github.com/gilbitron/laravel-vue-pagination/stargazers)
18+
* [Tell others about this project](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fgilbitron%2Flaravel-vue-pagination)
19+
* [Sponsor me on GitHub](https://github.com/users/gilbitron/sponsorship)
10820

10921
## Development
11022

11123
To work on the library locally, run the following command:
11224

11325
```bash
114-
npm run serve
26+
yarn dev
11527
```
11628

11729
To run the tests:
11830

11931
```bash
120-
npm run test
32+
yarn test
12133
```
12234

123-
## Show your Support
124-
125-
To show your support for my work on this project:
126-
127-
* [Star this repository](https://github.com/gilbitron/laravel-vue-pagination/stargazers)
128-
* [Tell others about this project](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fgilbitron%2Flaravel-vue-pagination)
129-
* [Sponsor me on GitHub](https://github.com/users/gilbitron/sponsorship)
130-
13135
## Credits
13236

133-
Laravel Vue Pagination was created by [Gilbert Pellegrom](https://gilbitron.me) from [Dev7studios](https://dev7studios.co). Released under the MIT license.
37+
Laravel Vue Pagination was created by [Gilbert Pellegrom](https://gilbitron.me). Released under the MIT license.

0 commit comments

Comments
 (0)