Skip to content

Commit eaaf9bc

Browse files
author
grinmax
committed
# Conflicts: # README.md
2 parents d43bf3b + 43da3c8 commit eaaf9bc

File tree

7 files changed

+79
-58
lines changed

7 files changed

+79
-58
lines changed

README.md

Lines changed: 69 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,57 @@
22
# Vue-smart-pagination
33
A data pagination component that splits any data into pages and has many settings. All data is stored in an array and can have any value.
44

5-
![img](https://github.com/grinmax/vue-smart-pagination/raw/master/src/assets/logo.png)
5+
## Demo
6+
![img](https://github.com/grinmax/vue-smart-pagination/raw/master/src/assets/demo.jpg)
7+
8+
[Demo page](http://github.webfriends.by/vue-smart-pagination/)
69

710
## Installation
8-
### NPM Установите пакет npm.
11+
### Install the NPM package.
912
```
1013
$ npm install vue-smart-pagination --save
1114
```
12-
Зарегистрируйте компонент.
15+
Register the component.
1316
* **ES5**
1417
```js
15-
var Pagination= require('vue-smart-pagination') Vue.component(pagination, Pagination)
18+
var Pagination= require('vue-smart-pagination')
19+
Vue.component(pagination, Pagination)
1620
```
1721
* **ES6**
1822
```js
19-
import Pagination from 'vue-smart-pagination' Vue.component('pagination', Pagination)
23+
import Pagination from 'vue-smart-pagination'
24+
Vue.component('pagination', Pagination)
2025
```
2126
## Usage
22-
Vue-smart-pagination состоит из двух основных компонентов: **PaginationPage** - отвечает за вывод контента страницы. **PaginationControl** - выводит кнопки контроля пагинацей. Оба компонента регистрируются глобально после установки плагина. Также существуют два основных объекта - `PaginationControlSettings` и `PaginationPageSettings`. `PaginationControlSettings` содержит настройки, относящиеся к управлению кнопок, стрелок, точек и стартовой страницы. `PaginationPageSettings`
23-
содержит настройки, относящиеся к управлению класса страницы, спиннера и анимации. Все они передаются через **props** - `“:settings="settings”`. Массив **array_data** служит для вывода данных на страницу и `является обязательным для заполнения`.
27+
Vue-smart-pagination contains two main components: **PaginationPage** - has content of the pages. **PaginationControl** - has content controls. Both components are registered globally after installing package. Also we have **props** - `:settings="settings”` which has two main objects - `PaginationControlSettings` и `PaginationPageSettings`.
28+
`PaginationControlSettings` contains settings related to buttons, arrows, dots and the start page.
29+
`PaginationPageSettings` contains settings related to the page, the spinner and animation of the content change.
30+
Array ** array_data ** serves to output data to the page and `is required to fill`.
2431

25-
**Пример:**
32+
**Example:**
2633
```js
2734
<template>
2835
<div id="app">
2936
<pagination-page :settings="settings">
3037
<div slot="page" slot-scope="item">
31-
</div>
32-
</div>
33-
</pagination-page>
34-
<pagination-control :settings="settings" @callMethod="test"/>
38+
{{ Your Data }}
3539
</div>
36-
</div>
40+
</pagination-page>
41+
<pagination-control :settings="settings" @callMethod="test" />
3742
</div>
3843
</template>
3944

4045
<script>
4146
import PaginationPage from './components/PaginationPage'
4247
import PaginationControl from './components/PaginationControl'
48+
4349
export default {
4450
name: 'App',
4551
components: {
4652
PaginationPage,
4753
PaginationControl
4854
},
55+
4956
data: function () {
5057
return {
5158
array_data: [
@@ -64,11 +71,13 @@ export default {
6471
]
6572
}
6673
},
74+
6775
methods: {
6876
test: function (e) {
6977
console.log(e)
7078
}
7179
},
80+
7281
computed: {
7382
settings: function () {
7483
return {
@@ -122,85 +131,94 @@ export default {
122131
}
123132
</script>
124133
```
125-
* Для вывода данных на страницу необходимо:
134+
**Adding Data to a Component:**
126135
127-
В массив `array_data` внести свои переменные (для вывода компонента переменной присваивается его название), затем в компоненте pagination-page записать их. Обращаемся к массиву элементов, указываем свойство originalEvent для вывода текущих данных и собственно саму переменную. Для вывода обычных данных используется `<div>`, а для компонентов - `<component>`. Строка `<div slot="page" slot-scope="item"></div>` является обязательной.
128-
**Пример:**
136+
In the array `array_data` we add data and output them to the pagination-page. When referring to an array of elements, specify the `originalEvent` property to display the current data.
137+
To display simple data, use `<div>`, and for components use `<component>`. `<div slot =" page "slot-scope =" item "> </ div>` is required.
138+
139+
**Example:**
129140
```
130141
array_data: [
131142
{
132143
data: 'apple',
133-
components: 'test1'
144+
component: 'testComponent'
134145
}
135146
]
136147
```
137148
```
138149
<pagination-page :settings="settings">
139150
<div slot="page" slot-scope="item">
140-
<div >{{item.originalEvent.data}}</div>
141-
<components :is="item.originalEvent.components"></components>
151+
<div>{{item.originalEvent.data}}</div>
152+
<components :is="item.originalEvent.component"></components>
142153
</div>
143154
</pagination-page>
144155
```
145-
* Для вывода кнопок пагинации вставляем в шаблон компонент `pagination-control`.
146-
**Пример:**
156+
** To display the pagination buttons, insert the `pagination-control` component into the template. **
157+
158+
**Example:**
147159
```
148-
<pagination-control :settings="settings">
149-
</pagination-control>
160+
<pagination-control :settings="settings" />
150161
```
151162
## Props
152-
Имя | Тип | Все значения | Значения по умолчанию| Описание
163+
Name | Type | All values | Default value | Description
153164
:---: | :---: | :---: |:---: | --- |
154165
*`PaginationControlSettings:`* |
155166
**Buttons settings:** |
156-
*controlClass*| String | - | - | Задает общий класс родительскому блоку с кнопками пагинации.
157-
*controlStyle* | String | square, circle, default | default |Задает вид кнопкам пагинации.
158-
*maxButtons* | Number | - | 5 |Задаёт максимальное количество кнопок пагинации на странице.
159-
*allpageButtonsStyle* | String | background: '', borderColor: '', color: '', backgroundHover: '', borderColorHover : '', colorHover: '', fontFamily: '' | background: ‘#fff’, borderColor: ‘#02C8F3’, color: '#02C8F3', backgroundHover: ‘#02C8F3’, borderColorHover : ‘#02C8F3’, colorHover: ‘#fff’, fontFamily: 'Avenir' | background - Задает задний фон кнопкам пагинации; borderColor - Задает цвет рамки кнопкам пагинации; color - Задает цвет кнопкам пагинации; backgroundHover - Задает задний фон кнопкам пагинации при наведении; borderColorHover - Задает цвет рамки кнопкам пагинации при наведении; colorHover - Задает цвет кнопкам пагинации при наведении; fontFamily - Задает шрифт кнопкам.
160-
*currentPageButtonStyle* | String | backgroundActive: '', borderColorActive: '', colorActive: '' | backgroundActive: '#02C8F3', borderColorActive: '#02C8F3', colorActive: '#fff' | backgroundActive - Задает задний фон активной кнопке; borderColorActive - Задает цвет рамки активной кнопке; colorActive - Задает цвет активной кнопке.
167+
*controlClass*| String | - | - | Common class to the parent block with pagination buttons.
168+
*controlStyle* | String | square, circle, default | default | Style of pagination buttons.
169+
*maxButtons* | Number | - | 5 | The maximum number of pagination buttons on the page.
170+
**allpageButtonsStyle** |
171+
*background* | String | - | #fff | Background color of buttons
172+
*borderColor* | String | - | #02C8F3 | Border color of buttons
173+
*color* | String | - | #02C8F3 | Color of buttons
174+
*backgroundHover* | String | - | #02C8F3 | Background color of buttons when hovering
175+
*borderColorHover* | String | - | #02C8F3 | Border color of buttons when hovering
176+
*colorHover* | String | - | #fff | Color of buttons when hovering
177+
*fontFamily* | String | - | Avenir | Font family of buttons
178+
**currentPageButtonStyle** |
179+
*backgroundActive* | String | - | #02C8F3 | Background color of active button
180+
*borderColorActive* | String | - | #02C8F3 | Border color of active button
181+
*colorActive* | String | - | #fff| Color of active button
161182
**Arrows settings:**|
162-
*hideArrows* | Boolean | true, false | false | Показывает либо скрывает стрелки пагинации.
163-
*arrowStyle* | String | styleArrow-1, styleArrow-2, styleArrow-3 | styleArrow-2 | Меняет вид стрелок.
164-
*arrowStyleColor* | String | - | #02C8F3 | Задает цвет стрелкам.
165-
*arrowStyleColorHover* | String | - | #fff | Задает цвет стрелкам при наведении.
183+
*hideArrows* | Boolean | true, false | false | Show or hide the arrows of pagination.
184+
*arrowStyle* | String | styleArrow-1, styleArrow-2, styleArrow-3 | styleArrow-2 | Styles icons of arrow.
185+
*arrowStyleColor* | String | - | #02C8F3 | Color of arrow.
186+
*arrowStyleColorHover* | String | - | #fff | Color of arrow when hovering.
166187
**Dots settings:** |
167-
*controlDotsStyle* | String | styleDots-1, styleDots-2, styleDots-3 | styleDots-1 | Меняет вид многоточия.
168-
*controlDotsColor* | String | - | #02C8F3 | Задает цвет многоточия.
169-
**pageStarted:** | Number | - | 1 | Задает стартовую страницу.
188+
*controlDotsStyle* | String | styleDots-1, styleDots-2, styleDots-3 | styleDots-1 | Styles of dots.
189+
*controlDotsColor* | String | - | #02C8F3 | Color of dots.
190+
**pageStarted:** | Number | - | 1 | Number of start page.
170191
*`PaginationPageSettings:`* |
171192
**Page settings:** |
172-
*pageClass* | String | - | - | Задает общий класс страницам.
193+
*pageClass* | String | - | - | Common class for all pages.
173194
**Spinner settings:** |
174-
*spinner* | Boolean | true, false | false | Показывает либо скрывает спиннер во время загрузки страницы.
175-
*spinnerStyle* | String | spinnerStyle-1, spinnerStyle-2, spinnerStyle-3 | spinnerStyle-3 | Меняет вид спиннера.
176-
*spinnerColor*| String | - | #fff | Задает цвет спиннера.
195+
*spinner* | Boolean | true, false | false | Show or hide loading spinner.
196+
*spinnerStyle* | String | spinnerStyle-1, spinnerStyle-2, spinnerStyle-3 | spinnerStyle-3 | Styles for loading spinner.
197+
*spinnerColor*| String | - | #fff | Color of loading spinner.
177198
**Animations settings:** |
178-
*animationPage* | String | fade, slide, bounce, default | default | Меняет вид анимации.
179-
## Method
180-
> Для вызова собственного метода, при переключении страниц, в компоненте `<pagination-control/>` в action callMethod нужно передать пользовательскую функцию, которая объявляется в объекте methods.
199+
*animationPage* | String | fade, slide, bounce, default | default | Animation when switching pages.
200+
## Methods
201+
> To call a custom method, when switching pages, in the `<pagination-control />` component in the action callMethod, you must pass a user-defined function that is declared in the methods object.
181202
182-
**Пример:**
203+
**Example:**
183204
```
184205
<pagination-control @callMethod =" test "/>
185206
```
186207
```
187-
methody: {
208+
methods: {
188209
test: function (e) {
189210
console.log (e)
190211
}
191212
}
192213
```
193-
### Совместимость с браузером
194-
Vue-smart-pagination успешно протестирован в браузерах таких как:
214+
### Browsers
215+
Vue-smart-pagination has been successfully tested in browsers such as:
195216
* Chrome (66.0)
196217
* Safari (11.1)
197218
* Opera (52.0)
198219
* Firefox (59.0.2)
199220
* Edge (38.14393.0.0)
200221
201-
## Лицензия
222+
## Developers License
202223
LLC WebFriends. 2018
203224
204-
## Demo
205-
![img](https://github.com/grinmax/vue-smart-pagination/raw/master/src/assets/demo.jpg)
206-

src/App.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ export default {
7373
components: 'test3'
7474
},
7575
{
76-
data: 'apple'
76+
data: 'Page 4'
7777
},
7878
{
79-
data: 'banana'
79+
data: 'Page 5'
8080
},
8181
{
82-
data: 'orange'
82+
data: 'Page 6'
8383
}
8484
],
8585
PaginationControlSettings: {
@@ -93,7 +93,7 @@ export default {
9393
},
9494
PaginationPageSettings: {
9595
spinnerSettings: {
96-
spinner: true,
96+
spinner: false,
9797
spinnerStyle: 'spinnerStyle-3'
9898
},
9999
animationSettings: {

src/assets/demo.png

-21.2 KB
Binary file not shown.

src/components/PaginationPage.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ export default {
9191
text-align: center;
9292
color: #000;
9393
font-family: "Comic Sans MS", sans-serif;
94+
display: flex;
95+
align-items: center;
96+
justify-content: center;
9497
}
9598
:root {
9699
--spinnerColor: #fff;

src/components/test1.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
components 1
3+
Page 1
44
</div>
55
</template>
66
<script>

src/components/test2.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
components 2
3+
Page 2
44
</div>
55
</template>
66
<script>

src/components/test3.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
components 3
3+
Page 3
44
</div>
55
</template>
66
<script>

0 commit comments

Comments
 (0)