File tree Expand file tree Collapse file tree 5 files changed +67
-173
lines changed Expand file tree Collapse file tree 5 files changed +67
-173
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <keep-alive >
4
- <component v-bind:is =" component" ></component >
5
- </keep-alive >
6
- <button v-on:click =" component = 'form-one'" >Show form one</button >
7
- <button v-on:click =" component = 'form-two'" >Show form two</button >
3
+ <add-blog ></add-blog >
8
4
</div >
9
5
</template >
10
6
11
7
<script >
12
8
// Imports
13
- import formOne from ' ./components/formOne.vue' ;
14
- import formTwo from ' ./components/formTwo.vue' ;
9
+ import addBlog from ' ./components/addBlog.vue' ;
15
10
16
11
export default {
17
12
components: {
18
- ' form-one' : formOne,
19
- ' form-two' : formTwo
13
+ ' add-blog' : addBlog
20
14
},
21
15
data () {
22
16
return {
23
- component : ' form-one '
17
+
24
18
}
25
19
},
26
20
methods: {
27
- handleSubmit : function (){
28
- alert (' thanks for submitting' );
29
- }
21
+
30
22
}
31
23
}
32
24
</script >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div id =" add-blog" >
3
+ <h2 >Add a New Blog Post</h2 >
4
+ <form >
5
+ <label >Blog Title:</label >
6
+ <input type =" text" v-model =" blog.title" required />
7
+ <label >Blog Content:</label >
8
+ <textarea v-model =" blog.content" ></textarea >
9
+ </form >
10
+ <div id =" preview" >
11
+ <h3 >Preview blog</h3 >
12
+ <p >Blog title: {{ blog.title }}</p >
13
+ <p >Blog content:</p >
14
+ <p style =" white-space : pre " >{{ blog.content }}</p >
15
+ </div >
16
+ </div >
17
+ </template >
18
+
19
+ <script >
20
+ // Imports
21
+
22
+ export default {
23
+ data () {
24
+ return {
25
+ blog: {
26
+ title: ' ' ,
27
+ content: ' '
28
+ }
29
+ }
30
+ },
31
+ methods: {
32
+
33
+ }
34
+ }
35
+ </script >
36
+
37
+ <style >
38
+ #add-blog * {
39
+ box-sizing : border-box ;
40
+ }
41
+ #add-blog {
42
+ margin : 20px auto ;
43
+ max-width : 500px ;
44
+ }
45
+ label {
46
+ display : block ;
47
+ margin : 20px 0 10px ;
48
+ }
49
+ input [type = " text" ], textarea {
50
+ display : block ;
51
+ width : 100% ;
52
+ padding : 8px ;
53
+ }
54
+ #preview {
55
+ padding : 10px 20px ;
56
+ border : 1px dotted #ccc ;
57
+ margin : 30px 0 ;
58
+ }
59
+ h3 {
60
+ margin-top : 10px ;
61
+ }
62
+ </style >
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments