File tree Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Original file line number Diff line number Diff line change 3
3
<h2 >Add a New Blog Post</h2 >
4
4
<form >
5
5
<label >Blog Title:</label >
6
- <input type =" text" v-model =" blog.title" required />
6
+ <input type =" text" v-model.lazy =" blog.title" required />
7
7
<label >Blog Content:</label >
8
- <textarea v-model =" blog.content" ></textarea >
8
+ <textarea v-model.lazy.trim =" blog.content" ></textarea >
9
+ <div id =" checkboxes" >
10
+ <p >Blog Categories:</p >
11
+ <label >Ninjas</label >
12
+ <input type =" checkbox" value =" ninjas" v-model =" blog.categories" />
13
+ <label >Wizards</label >
14
+ <input type =" checkbox" value =" wizards" v-model =" blog.categories" />
15
+ <label >Mario</label >
16
+ <input type =" checkbox" value =" mario" v-model =" blog.categories" />
17
+ <label >Cheese</label >
18
+ <input type =" checkbox" value =" cheese" v-model =" blog.categories" />
19
+ </div >
9
20
</form >
10
21
<div id =" preview" >
11
22
<h3 >Preview blog</h3 >
12
23
<p >Blog title: {{ blog.title }}</p >
13
24
<p >Blog content:</p >
14
25
<p style =" white-space : pre " >{{ blog.content }}</p >
26
+ <p >Blog Categories:</p >
27
+ <ul >
28
+ <li v-for =" category in blog.categories" >{{ category }}</li >
29
+ </ul >
15
30
</div >
16
31
</div >
17
32
</template >
@@ -24,7 +39,8 @@ export default {
24
39
return {
25
40
blog: {
26
41
title: ' ' ,
27
- content: ' '
42
+ content: ' ' ,
43
+ categories: []
28
44
}
29
45
}
30
46
},
@@ -59,4 +75,11 @@ input[type="text"], textarea{
59
75
h3 {
60
76
margin-top : 10px ;
61
77
}
78
+ #checkboxes input {
79
+ display : inline-block ;
80
+ margin-right : 10px ;
81
+ }
82
+ #checkboxes label {
83
+ display : inline-block ;
84
+ }
62
85
</style >
You can’t perform that action at this time.
0 commit comments