File tree Expand file tree Collapse file tree 6 files changed +49
-56
lines changed Expand file tree Collapse file tree 6 files changed +49
-56
lines changed Original file line number Diff line number Diff line change 8
8
<script >
9
9
// Imports
10
10
import showBlogs from ' ./components/showBlogs.vue' ;
11
- import listBlogs from ' ./components/listBlogs.vue' ;
12
11
import header from ' ./components/header.vue' ;
13
12
14
13
export default {
Original file line number Diff line number Diff line change @@ -63,17 +63,21 @@ export default {
63
63
}
64
64
#add-blog {
65
65
margin : 20px auto ;
66
- max-width : 500px ;
66
+ max-width : 600px ;
67
+ padding : 20px ;
67
68
}
68
69
label {
69
70
display : block ;
70
71
margin : 20px 0 10px ;
71
72
}
72
- input [type = " text" ], textarea {
73
+ input [type = " text" ], textarea , select {
73
74
display : block ;
74
75
width : 100% ;
75
76
padding : 8px ;
76
77
}
78
+ textarea {
79
+ height :200px ;
80
+ }
77
81
#preview {
78
82
padding : 10px 20px ;
79
83
border : 1px dotted #ccc ;
90
94
display : inline-block ;
91
95
margin-top : 0 ;
92
96
}
97
+ hr {
98
+ display : none ;
99
+ }
100
+ button {
101
+ display : block ;
102
+ margin : 20px 0 ;
103
+ background : crimson ;
104
+ color : #fff ;
105
+ border : 0 ;
106
+ padding : 14px ;
107
+ border-radius : 4px ;
108
+ font-size : 18px ;
109
+ cursor : pointer ;
110
+ }
93
111
</style >
Original file line number Diff line number Diff line change 24
24
a {
25
25
color : #fff ;
26
26
text-decoration : none ;
27
- padding : 6 px 8 px ;
27
+ padding : 12 px ;
28
28
border-radius : 5px ;
29
29
}
30
30
nav {
31
- background : #444 ;
32
- padding : 20 px 0 ;
31
+ background : crimson ;
32
+ padding : 30 px 0 ;
33
33
margin-bottom : 40px ;
34
34
}
35
35
.router-link-active {
36
- background : #eee ;
36
+ background : rgba ( 255 , 255 , 255 , 0.8 ) ;
37
37
color : #444 ;
38
38
}
39
39
</style >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 4
4
<input type =" text" v-model =" search" placeholder =" search blogs" />
5
5
<div v-for =" blog in filteredBlogs" class =" single-blog" >
6
6
<router-link v-bind:to =" '/blog/' + blog.id" ><h2 >{{ blog.title }}</h2 ></router-link >
7
- <article >{{ blog.body }}</article >
7
+ <article >{{ blog.content }}</article >
8
8
</div >
9
9
</div >
10
10
</template >
@@ -21,8 +21,16 @@ export default {
21
21
}
22
22
},
23
23
created () {
24
- this .$http .get (' http://jsonplaceholder.typicode.com/posts' ).then (function (data ){
25
- this .blogs = data .body .slice (0 ,10 );
24
+ this .$http .get (' https://nn-vue-playlist.firebaseio.com/posts.json' ).then (function (data ){
25
+ return data .json ()
26
+ }).then (function (data ){
27
+ var blogsArray = [];
28
+ for (let key in data){
29
+ data[key].id = key;
30
+ blogsArray .push (data[key]);
31
+ }
32
+ this .blogs = blogsArray;
33
+ // console.log(this.blogs);
26
34
});
27
35
},
28
36
mixins: [searchMixin]
@@ -39,6 +47,7 @@ export default {
39
47
margin : 20px 0 ;
40
48
box-sizing : border-box ;
41
49
background : #eee ;
50
+ border : 1px dotted #aaa ;
42
51
}
43
52
44
53
#show-blogs a {
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div id =" single-blog" >
3
3
<h1 >{{ blog.title }}</h1 >
4
- <article >{{ blog.body }}</article >
4
+ <article >{{ blog.content }}</article >
5
+ <p >Author: {{ blog.author }}</p >
6
+ <p >Categories:</p >
7
+ <ul >
8
+ <li v-for =" category in blog.categories" >{{ category }}</li >
9
+ </ul >
5
10
</div >
6
11
</div >
7
12
</template >
@@ -18,9 +23,10 @@ export default {
18
23
}
19
24
},
20
25
created () {
21
- this .$http .get (' http://jsonplaceholder.typicode.com/posts/' + this .id ).then (function (data ){
22
- // console.log(data);
23
- this .blog = data .body ;
26
+ this .$http .get (' https://nn-vue-playlist.firebaseio.com/posts/' + this .id + ' .json' ).then (function (data ){
27
+ return data .json ();
28
+ }).then (function (data ){
29
+ this .blog = data;
24
30
});
25
31
}
26
32
}
@@ -30,5 +36,8 @@ export default {
30
36
#single-blog {
31
37
max-width : 960px ;
32
38
margin : 0 auto ;
39
+ padding : 20px ;
40
+ background : #eee ;
41
+ border : 1px dotted #aaa ;
33
42
}
34
43
</style >
You can’t perform that action at this time.
0 commit comments