Skip to content

Commit 1d5f2eb

Browse files
committed
Finished Forms lessons
1 parent 26abc3c commit 1d5f2eb

File tree

3 files changed

+120
-5
lines changed

3 files changed

+120
-5
lines changed

index.html

+61
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,69 @@ <h1>Build a List with Vue.js</h1>
3737
<ol>
3838
<li v-for="game in games">{{ game.title }}</li>
3939
</ol>
40+
41+
<h1>Data Properties</h1>
42+
<p>{{ initial }}</p>
43+
44+
<h1>Methods</h1>
45+
<p>{{ startString }}</p>
46+
<button class="button" @click="addToStart">Add to String</button>
47+
48+
<h1>Loop Through a Range</h1>
49+
<span v-for="number in 20">{{ number }} &nbsp;</span>
50+
51+
<h1>Loop Through an Array</h1>
52+
<ul>
53+
<li v-for="item in items">{{ item }}</li>
54+
</ul>
55+
56+
<h1>Looping with an Index</h1>
57+
<ul>
58+
<li v-for="(framework, key) in frameworks">{{ key }} - {{ framework.content }}</li>
59+
</ul>
60+
61+
<h1>Looping through Objects</h1>
62+
<ol>
63+
<li v-for="music in musics">{{ music }}</li>
64+
</ol>
65+
66+
<h1>Looping through Objects and Keys</h1>
67+
<ol>
68+
<li v-for="(music, property) in musics"><span class="capitalize">{{ property }}</span> - {{ music }}</li>
69+
</ol>
70+
71+
<h1>Looping through Objects, Keys, and Indexes</h1>
72+
<ul>
73+
<li v-for="(baby, property, index) in babies">{{ index }} - <span class="capitalize">{{ property }}</span> - {{ baby }}</li>
74+
</ul>
75+
76+
<h1>Build an Input Field</h1>
77+
<label for="fullName">Full Name</label>
78+
<input id="fullName" v-model="fullName" class="margin-left-15" placeholder="Makima San" />
79+
<p>Your Full Name is {{ fullName }}.</p>
80+
81+
<h1>Dropdown Menus</h1>
82+
<select v-model="selected" v-bind:selected="selected">
83+
<option v-for="rate in rating" v-bind:value="rate.value">{{ rate.title }}</option>
84+
</select>
85+
<p>{{ selected }}</p>
86+
87+
<h1>Checkbox</h1>
88+
<label for="friends" class="block"><input type="checkbox" id="friends" value="Friends" v-model="recommended"> Friends</label>
89+
<label for="acquaintance" class="block"><input type="checkbox" id="acquaintance" value="Acquaintances" v-model="recommended"> Acquaintances</label>
90+
91+
<p>Recommended for {{ recommended }}</p>
92+
93+
<h1>Radio</h1>
94+
<p>Would you recommend this tutorial?</p>
95+
<label for="yes"><input type="radio" id="yes" value="Yes" v-model="tutorial_review"/>Yes</label>
96+
<label for="no"><input type="radio" id="no" value="No" v-model="tutorial_review"/>No</label>
97+
<br /><br />
98+
Recommendable: {{ tutorial_review }}
99+
40100
</div>
41101

42102
<script src="main.js"></script>
103+
43104
</body>
44105
</html>

main.js

+34-2
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,57 @@ const app = Vue.createApp({
66
white: "white",
77
text: "League of Legends",
88
inputText: "",
9-
timer: 100,
9+
tutorial_review: "",
10+
startString: "Hello world",
11+
timer: 5,
12+
initial: 0,
1013
visible: true,
14+
fullName: "Makima San",
15+
selected: 3,
16+
recommended: [],
17+
rating: [
18+
{ title: "Best", value: 5 },
19+
{ title: "Good", value: 4 },
20+
{ title: "Okay", value: 3 },
21+
{ title: "Okay", value: 2 },
22+
{ title: "Bad", value: 1 }
23+
],
1124
games: [
1225
{ title: "League of Legends", id: 6329 },
1326
{ title: "Valorant", id: 6330 },
1427
{ title: "Sims", id: 6331 }
15-
]
28+
],
29+
frameworks: [
30+
{ content: "Vue JS" },
31+
{ content: "React" },
32+
{ content: "Angular" }
33+
],
34+
items: ["Kare-kare", "Adobong Atay"],
35+
musics: {
36+
title: "Nobody Gets Me",
37+
author: "SZA"
38+
},
39+
babies: {
40+
name: "Ace",
41+
role: "Dad"
42+
}
1643
}
1744
},
1845
mounted() {
1946
setInterval(() => {
2047
if (this.timer > 0) {
2148
this.timer--
49+
} else {
50+
this.initial = 500
2251
}
2352
}, 1000)
2453
},
2554
methods: {
2655
checkPalindrome() {
2756
this.text = this.text.split("").reverse().join("")
57+
},
58+
addToStart() {
59+
this.startString += " " + this.text
2860
}
2961
}
3062
}).mount("#app")

style.css

+25-3
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,40 @@ body
1313
padding: 3rem;
1414
}
1515

16+
textarea,
17+
input:not(type="checkbox") {
18+
padding: 1rem 2rem;
19+
min-width: 50vh;
20+
}
21+
22+
select {
23+
padding: .5rem 1rem;
24+
min-width: 15vh;
25+
}
26+
27+
p {
28+
white-space: pre-line;
29+
}
30+
1631
.white {
1732
color: var(--white);
1833
}
1934

35+
.capitalize {
36+
text-transform: capitalize;
37+
}
38+
2039
.button {
2140
background: var(--accent);
2241
padding: 1rem 2rem;
2342
border: none;
2443
font-size: var(--fontSize);
2544
}
2645

27-
textarea {
28-
padding: 1rem 2rem;
29-
min-width: 50vh;
46+
.block {
47+
display: block;
48+
}
49+
50+
.margin-left-15 {
51+
margin-left: 15px;
3052
}

0 commit comments

Comments
 (0)