2
2
<div >
3
3
<v-app id =" inspire" >
4
4
<sidebar ></sidebar >
5
- <v-toolbar color =" indigo" dark fixed app >
5
+ <v-toolbar color =" indigo" dark fixed app >
6
6
<v-toolbar-side-icon @click.stop =" toggleSidebar()" ></v-toolbar-side-icon >
7
7
<v-toolbar-title >Galleria</v-toolbar-title >
8
8
</v-toolbar >
9
- <v-content >Placeholder content</v-content >
9
+ <v-content >
10
+ Placeholder content {{ photos.length }}
11
+ <v-layout >
12
+ <v-flex xs12 sm8 offset-sm2 >
13
+ <v-card >
14
+ <v-container grid-list-sm fluid >
15
+ <v-layout row wrap >
16
+ <v-flex v-for =" n in photos.length - 1" :key =" n" xs3 d-flex >
17
+ <v-card flat tile class =" d-flex" >
18
+
19
+ <v-img :src =" CBv1+'/photos/'+photos[n].name" aspect-ratio =" 1" class =" grey lighten-2" >
20
+ <span > {{ photos[n].name }} </span >
21
+ <span v-on:click =" deletePhoto(photos[n].name)" > Elimina </span >
22
+ <v-layout slot =" placeholder" fill-height align-center justify-center ma-0 >
23
+ <v-progress-circular indeterminate color =" grey lighten-5" ></v-progress-circular >
24
+ </v-layout >
25
+ </v-img >
26
+ </a >
27
+ </v-card >
28
+ </v-flex >
29
+ </v-layout >
30
+ </v-container >
31
+ </v-card >
32
+ </v-flex >
33
+ </v-layout >
34
+ </v-content >
10
35
</v-app >
11
36
</div >
12
37
</template >
@@ -16,15 +41,43 @@ import sidebar from "../components/Sidebar"
16
41
export default {
17
42
components: { sidebar },
18
43
name: ' HelloWorld' ,
44
+ watch: {
45
+ photosN : function () {
46
+ this .l = this .photos .length
47
+ }
48
+ },
49
+ mounted () {
50
+ this .getPhotos ()
51
+ },
19
52
methods: {
53
+ getPhotos : function () {
54
+ let axios = this .$axios
55
+ let CBv1 = this .$data .CBv1
56
+ axios .get (CBv1 + ' /photos' )
57
+ .then (function (response ) {
58
+ this .$data .photos = response .data
59
+ }.bind (this ))
60
+ },
61
+ deletePhoto : function (name ) {
62
+ let axios = this .$axios
63
+ let CBv1 = this .$data .CBv1
64
+ axios .delete (CBv1 + ' /photos/' + name)
65
+ .then (function (response ) {
66
+ this .getPhotos ()
67
+ }.bind (this ))
68
+ },
20
69
toggleSidebar : function () {
21
70
let currentStatus = this .$store .getters .drawerStatus
22
71
this .$store .commit (' toggleDrawer' , ! currentStatus)
23
72
}
24
73
},
25
74
data () {
26
75
return {
76
+ CB : process .env .CB_ENDPOINT + process .env .APIv2 ,
77
+ CBv1: process .env .CB_ENDPOINT + process .env .APIv1 ,
78
+ photos: [],
27
79
drawer: null ,
80
+ l: null ,
28
81
};
29
82
},
30
83
};
0 commit comments