commit | author | age
|
a19e6e
|
1 |
<template> |
326c8c
|
2 |
<form @submit.prevent="submitForm"> |
a19e6e
|
3 |
<div class="form-control"> |
CM |
4 |
<label for="user-name">Your Name</label> |
326c8c
|
5 |
<input id="user-name" name="user-name" type="text" v-model="userName" /> |
a19e6e
|
6 |
</div> |
CM |
7 |
<div class="form-control"> |
|
8 |
<label for="age">Your Age (Years)</label> |
|
9 |
<input id="age" name="age" type="number" /> |
|
10 |
</div> |
|
11 |
<div class="form-control"> |
|
12 |
<label for="referrer">How did you hear about us?</label> |
|
13 |
<select id="referrer" name="referrer"> |
|
14 |
<option value="google">Google</option> |
|
15 |
<option value="wom">Word of mouth</option> |
|
16 |
<option value="newspaper">Newspaper</option> |
|
17 |
</select> |
|
18 |
</div> |
|
19 |
<div class="form-control"> |
|
20 |
<h2>What are you interested in?</h2> |
|
21 |
<div> |
|
22 |
<input id="interest-news" name="interest" type="checkbox" /> |
|
23 |
<label for="interest-news">News</label> |
|
24 |
</div> |
|
25 |
<div> |
|
26 |
<input id="interest-tutorials" name="interest" type="checkbox" /> |
|
27 |
<label for="interest-tutorials">Tutorials</label> |
|
28 |
</div> |
|
29 |
<div> |
|
30 |
<input id="interest-nothing" name="interest" type="checkbox" /> |
|
31 |
<label for="interest-nothing">Nothing</label> |
|
32 |
</div> |
|
33 |
</div> |
|
34 |
<div class="form-control"> |
|
35 |
<h2>How do you learn?</h2> |
|
36 |
<div> |
|
37 |
<input id="how-video" name="how" type="radio" /> |
|
38 |
<label for="how-video">Video Courses</label> |
|
39 |
</div> |
|
40 |
<div> |
|
41 |
<input id="how-blogs" name="how" type="radio" /> |
|
42 |
<label for="how-blogs">Blogs</label> |
|
43 |
</div> |
|
44 |
<div> |
|
45 |
<input id="how-other" name="how" type="radio" /> |
|
46 |
<label for="how-other">Other</label> |
|
47 |
</div> |
|
48 |
</div> |
|
49 |
<div> |
|
50 |
<button>Save Data</button> |
|
51 |
</div> |
|
52 |
</form> |
|
53 |
</template> |
|
54 |
|
326c8c
|
55 |
<script> |
CM |
56 |
export default { |
|
57 |
data() { |
|
58 |
return { |
|
59 |
userName: '', |
|
60 |
} |
|
61 |
}, |
|
62 |
methods: { |
|
63 |
submitForm() { |
|
64 |
console.log('Username: ' + this.userName ); |
|
65 |
this.userName = ''; |
|
66 |
} |
|
67 |
} |
|
68 |
|
|
69 |
} |
|
70 |
</script> |
|
71 |
|
a19e6e
|
72 |
<style scoped> |
CM |
73 |
form { |
|
74 |
margin: 2rem auto; |
|
75 |
max-width: 40rem; |
|
76 |
border-radius: 12px; |
|
77 |
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26); |
|
78 |
padding: 2rem; |
|
79 |
background-color: #ffffff; |
|
80 |
} |
|
81 |
|
|
82 |
.form-control { |
|
83 |
margin: 0.5rem 0; |
|
84 |
} |
|
85 |
|
|
86 |
label { |
|
87 |
font-weight: bold; |
|
88 |
} |
|
89 |
|
|
90 |
h2 { |
|
91 |
font-size: 1rem; |
|
92 |
margin: 0.5rem 0; |
|
93 |
} |
|
94 |
|
|
95 |
input, |
|
96 |
select { |
|
97 |
display: block; |
|
98 |
width: 100%; |
|
99 |
font: inherit; |
|
100 |
margin-top: 0.5rem; |
|
101 |
} |
|
102 |
|
|
103 |
select { |
|
104 |
width: auto; |
|
105 |
} |
|
106 |
|
|
107 |
input[type='checkbox'], |
|
108 |
input[type='radio'] { |
|
109 |
display: inline-block; |
|
110 |
width: auto; |
|
111 |
margin-right: 1rem; |
|
112 |
} |
|
113 |
|
326c8c
|
114 |
input[type='checkbox']+label, |
CM |
115 |
input[type='radio']+label { |
a19e6e
|
116 |
font-weight: normal; |
CM |
117 |
} |
|
118 |
|
|
119 |
button { |
|
120 |
font: inherit; |
|
121 |
border: 1px solid #0076bb; |
|
122 |
background-color: #0076bb; |
|
123 |
color: white; |
|
124 |
cursor: pointer; |
|
125 |
padding: 0.75rem 2rem; |
|
126 |
border-radius: 30px; |
|
127 |
} |
|
128 |
|
|
129 |
button:hover, |
|
130 |
button:active { |
|
131 |
border-color: #002350; |
|
132 |
background-color: #002350; |
|
133 |
} |
|
134 |
</style> |