-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11-main.js
36 lines (31 loc) · 1.04 KB
/
11-main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
new Vue({
el: 'main',
data: {
albums : []
},
mounted(){
console.log("Instancia montada");
this.cargarAlbums();
},
methods:{
cargarAlbums(){
/* // CON RESOURCE
//this.$http.get('https://randomuser.me/api/?results=500')
this.$http.get('https://jsonplaceholder.typicode.com/photos')
.then((respuesta) => {
//this.albums = respuesta.body;
//console.log(respuesta);
for (var i = 0; i < 100; i++) {
this.albums.push( respuesta.body[i] );
}
});*/
// CON AXIOS
axios.get('https://jsonplaceholder.typicode.com/photos')
.then((respuesta) => {
for (var i = 0; i < 50; i++) {
this.albums.push( respuesta.data[i] );
}
});
}
}
});