@@ -9,7 +9,7 @@ export default {
9
9
render (h ) {
10
10
return (
11
11
< div id= " app" >
12
- < datasource table- data= {this .information } limits= {this .limits } actions= {this .actions } columns= {this .columns } pagination= {this .pagination } onChange= {this .change }>< / datasource>
12
+ < datasource table- data= {this .information } limits= {this .limits } actions= {this .actions } columns= {this .columns } pagination= {this .pagination } onChange= {this .change } onSearching = { this . searching } >< / datasource>
13
13
< / div>
14
14
)
15
15
},
@@ -29,15 +29,15 @@ export default {
29
29
key: ' name'
30
30
},
31
31
{
32
- name: ' Year ' ,
33
- key: ' year ' ,
32
+ name: ' City ' ,
33
+ key: ' city ' ,
34
34
render : function (value ) {
35
35
return ` <strong>${ value} </strong>`
36
36
}
37
37
},
38
38
{
39
- name: ' Code color ' ,
40
- key: ' pantone_value '
39
+ name: ' Company ' ,
40
+ key: ' company '
41
41
}
42
42
],
43
43
actions: [
@@ -95,42 +95,30 @@ export default {
95
95
}
96
96
],
97
97
limits: [3 , 5 , 10 , 15 , 20 ],
98
- current_page: 1 ,
99
- per_page: 3 ,
100
- total: 0
101
- }
102
- },
103
- computed: {
104
- pagination () {
105
- return {
106
- total: this .total ,
107
- per_page: 3 ,
108
- current_page: this .current_page ,
109
- last_page: 5 ,
110
- from: (this .current_page === 1 ) ? 1 : this .per_page ,
111
- to: (this .current_page === 1 ) ? this .per_page : this .per_page * this .current_page
112
- }
98
+ page: 1 ,
99
+ perpage: 10 ,
100
+ pagination: {},
101
+ search: ' '
113
102
}
114
103
},
115
104
methods: {
116
- getData () {
117
- axios .get (` https ://reqres.in/api/products ?per_page=${ this .pagination . per_page } &page=${ this .pagination . current_page } ` )
105
+ async getData () {
106
+ await axios .get (` http ://young-falls-97690.herokuapp.com/getusers ?per_page=${ this .perpage } &page=${ this .page } &search= ${ this . search } ` )
118
107
.then ((response ) => {
119
- this .pagination .per_page = parseInt (response .data .per_page )
120
- this .per_page = parseInt (response .data .per_page )
121
- this .total = parseInt (response .data .total )
122
- this .pagination .current_page = parseInt (response .data .page )
123
- this .current_page = parseInt (response .data .page )
124
- this .pagination .last_page = parseInt (response .data .total_pages )
108
+ this .pagination = response .data .pagination
125
109
this .information = response .data .data
126
110
})
127
111
.catch ((error ) => {
128
112
console .error (error)
129
113
})
130
114
},
131
115
change (value ) {
132
- this .pagination .per_page = parseInt (value .perpage )
133
- this .pagination .current_page = parseInt (value .page )
116
+ this .page = value .page
117
+ this .perpage = value .perpage
118
+ this .getData ()
119
+ },
120
+ searching (value ) {
121
+ this .search = value
134
122
this .getData ()
135
123
}
136
124
}
0 commit comments