-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
175 lines (165 loc) · 3.31 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
const menus = [
{
title: "Home",
component: {
template: /*html*/`<div>A Home Page</div>`
}
},
{
title: "About",
component: {
template: /*html*/`<div>An About Page</div>`
}
},
{
title: "Contact",
component: {
template: /*html*/`<div>A Contact Page</div>`
}
}
]
const app = Vue.createApp({
data() {
return {
onHoverTitle: "reactive title",
description: "This is my third app.",
white: "white",
text: "League of Legends",
inputText: "",
tutorial_review: "",
startString: "Hello world",
timer: 5,
initial: 0,
visible: true,
fullName: "Makima San",
selected: 3,
currentTab: "Home",
tabs: ["Home", "About", "Contact"],
menus,
currentMenu: menus[0],
recommended: [],
rating: [
{ title: "Best", value: 5 },
{ title: "Good", value: 4 },
{ title: "Okay", value: 3 },
{ title: "Okay", value: 2 },
{ title: "Bad", value: 1 }
],
games: [
{ title: "League of Legends", id: 6329 },
{ title: "Valorant", id: 6330 },
{ title: "Sims", id: 6331 }
],
frameworks: [
{ content: "Vue JS" },
{ content: "React" },
{ content: "Angular" }
],
headers: [
{ id: 5425, title: "The first header", headerFontSize: 14 },
{ id: 5426, title: "The second header", headerFontSize: 14 },
{ id: 5427, title: "The third header", headerFontSize: 14 }
],
items: ["Kare-kare", "Adobong Atay"],
musics: {
title: "Nobody Gets Me",
author: "SZA"
},
babies: {
name: "Ace",
role: "Dad"
}
}
},
mounted() {
setInterval(() => {
if (this.timer > 0) {
this.timer--
} else {
this.initial = 500
}
}, 1000)
},
computed: {
currentTabComponent() {
return "tab-" + this.currentTab.toLowerCase()
},
currentMenuComponent() {
return "menu-" + this.currentMenu.title.toLowerCase()
}
},
methods: {
checkPalindrome() {
this.text = this.text.split("").reverse().join("")
},
addToStart() {
this.startString += " " + this.text
},
increaseTextSize(index) {
this.headers[index].headerFontSize += 10;
}
}
})
app.component("first-component", {
data() {
return {
incrementMe: 0
}
},
template:
/*html*/
`<button class="button white" @click="incrementMe++">Clicked {{ incrementMe }} times</button>`
})
app.component("body-component", {
props: ['title'],
template:
/*html*/
`<h2>{{ title }}</h2>`
})
app.component("header-component", {
props: ['title'],
template:
/*html*/
`<div class="header-component">
<h2>{{ title }}</h2>
<button class="button" @click="$.emit('increase-text-size')">Increase text size</button>
</div>`
})
app.component("slot-component", {
template:
/*html*/
`<div>
<p>This is my component.</p>
<slot></slot>
</div>`
})
app.component("tab-home", {
template:
/*html*/
`<div class="navigation">Home Information</div>`
})
app.component("tab-about", {
template:
/*html*/
`<div class="navigation">About Information</div>`
})
app.component("tab-contact", {
template:
/*html*/
`<div class="navigation">Contact Information</div>`
})
app.component("menu-home", {
template:
/*html*/
`<div class="navigation">Home Page</div>`
})
app.component("menu-about", {
template:
/*html*/
`<div class="navigation">About Page</div>`
})
app.component("menu-contact", {
template:
/*html*/
`<div class="navigation">Contact Page</div>`
}).mount("#app")