File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,9 @@ export default {
22
22
} ,
23
23
// eslint-disable-next-line
24
24
setup ( props , context ) {
25
- // Total
25
+ /**
26
+ * The number of pages available based on the results returned in the latestQuery prop.
27
+ */
26
28
const pageCount = computed ( ( ) => {
27
29
const q = props . latestQuery
28
30
if ( q && q . response ) {
@@ -31,7 +33,14 @@ export default {
31
33
return 1
32
34
}
33
35
} )
34
- // Current Page
36
+
37
+ /**
38
+ * The `currentPage` is calculated based on the $limit and $skip values provided in
39
+ * the v-model object.
40
+ *
41
+ * Setting `currentPage` to a new numeric value will emit the appropriate values out
42
+ * the v-model. (using the default `input` event)
43
+ */
35
44
const currentPage = computed ( {
36
45
set ( pageNumber : number ) {
37
46
if ( pageNumber < 1 ) {
@@ -67,6 +76,9 @@ export default {
67
76
function toEnd ( ) : void {
68
77
currentPage . value = pageCount . value
69
78
}
79
+ function toPage ( pageNumber ) : void {
80
+ currentPage . value = pageNumber
81
+ }
70
82
71
83
function next ( ) : void {
72
84
currentPage . value ++
@@ -85,6 +97,7 @@ export default {
85
97
canNext : canNext . value ,
86
98
toStart,
87
99
toEnd,
100
+ toPage,
88
101
prev,
89
102
next
90
103
} )
You can’t perform that action at this time.
0 commit comments