Skip to content

Commit 1a39f33

Browse files
authored
Merge pull request #3 from edu4024/feature/page-auto-update
feature for auto update page
2 parents e95c644 + e3fdb4e commit 1a39f33

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Vue-smart-pagination contains two main components:
3737

3838
Both components are registered globally after installing package.
3939

40-
Also we have **props** - `:settings="settings”` which has two main objects - `PaginationControlSettings` и `PaginationPageSettings`.
40+
Also we have **props** - `:settings="settings”` which has two main objects - `PaginationControlSettings` и `PaginationPageSettings`, also we have property - `pageToChange`.
4141

4242

4343
`PaginationControlSettings` contains settings related to buttons, arrows, dots and the start page.
@@ -46,6 +46,9 @@ Also we have **props** - `:settings="settings”` which has two main objects - `
4646
`PaginationPageSettings` contains settings related to the page, the spinner and animation of the content change.
4747

4848

49+
`pageToChange` contains actual page, update after change page value.
50+
51+
4952
Array **arrayData** serves to output data to the page and `is required to fill`.
5053

5154
**Example:**

src/components/PaginationControl.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
113113
export default {
114114
name: 'PaginationControl',
115-
props: ['settings'],
115+
props: ['settings', 'pageToChange'],
116116
data: function () {
117117
return {
118118
curIndex: 0,
@@ -343,6 +343,16 @@
343343
watch: {
344344
'def': function (oldVal, newVal) {
345345
this.rootColor()
346+
},
347+
'pageToChange': function (newVal) {
348+
try {
349+
let val = parseInt(newVal)
350+
if (val < 0) val = 0
351+
if (val > this.settings.arrayData.length) val = this.settings.arrayData.length
352+
this.curIndex = val
353+
} catch (e) {
354+
console.log(e)
355+
}
346356
}
347357
}
348358
}

0 commit comments

Comments
 (0)