This repository was archived by the owner on Jun 10, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-12
lines changed Expand file tree Collapse file tree 1 file changed +22
-12
lines changed Original file line number Diff line number Diff line change 11<script >
2+ import axios from ' axios'
23import Datasource from ' ./components/ServerDatasource.vue'
34export default {
45 name: ' app' ,
56 components: {
67 Datasource
78 },
9+ mounted () {
10+ this .getSource ()
11+ },
812 render (h ) {
913 return (
1014 < div id= " app" >
11- < datasource source= " http://young-falls-97690.herokuapp.com/getusers" limits= {this .limits } actions= {this .actions } columns= {this .columns }>< / datasource>
15+ < h2 class = " text-center mb3" > Vue Datasource< / h2>
16+ < datasource source= {this .information } limits= {this .limits } actions= {this .actions } columns= {this .columns } on- change= {this .change }>< / datasource>
1217 < / div>
1318 )
1419 },
@@ -21,19 +26,15 @@ export default {
2126 key: ' id'
2227 },
2328 {
24- name: ' Name' ,
25- key: ' name '
29+ name: ' First Name' ,
30+ key: ' first_name '
2631 },
2732 {
28- name: ' City ' ,
29- key: ' city ' ,
33+ name: ' Last Name ' ,
34+ key: ' last_name ' ,
3035 render : function (value ) {
3136 return ` <strong>${ value} </strong>`
3237 }
33- },
34- {
35- name: ' Company' ,
36- key: ' company'
3738 }
3839 ],
3940 actions: [
@@ -98,14 +99,19 @@ export default {
9899 }
99100 },
100101 methods: {
102+ getSource () {
103+ axios .get (` https://reqres.in/api/users?per_page=${ this .perpage } &page=${ this .page } ` ).then ((response ) => {
104+ this .information = response .data .data
105+ })
106+ },
101107 change (value ) {
102108 this .page = value .page
103109 this .perpage = value .perpage
104- this .getData ()
110+ this .getSource ()
105111 },
106112 searching (value ) {
107113 this .search = value
108- this .getData ()
114+ this .getSource ()
109115 }
110116 }
111117}
@@ -115,6 +121,10 @@ export default {
115121@import url (' https://fonts.googleapis.com/css?family=Roboto:300,400,500,700' );
116122@import " ./assets/app.css" ;
117123#app {
118- font-family : ' Roboto' !important
124+ font-family : ' Roboto' !important ;
125+ margin : 150px 0 ;
126+ }
127+ .mb3 {
128+ margin-bottom : 30px ;
119129}
120130 </style >
You can’t perform that action at this time.
0 commit comments