-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
69 lines (62 loc) · 1.71 KB
/
app.js
File metadata and controls
69 lines (62 loc) · 1.71 KB
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
import { createApp } from "https://unpkg.com/vue@3/dist/vue.esm-browser.js";
import Header from "./components/header.js";
import Footer from "./components/footer.js";
import SwiperComponent from "./components/testswiper.js";
let app = Vue.createApp({
// template: `{{Header}}{{app}}`,
data() {
return {
message: "Hello Vue!",
name: "Nati",
lastName: "Nine",
age: 30,
email: "",
isShowData: false,
salary: 15_000,
adresss: `<strong>Bangkok</strong>`,
picture: `https://img.freepik.com/free-photo/html-css-collage-concept-with-person_23-2150061993.jpg?w=1800&t=st=1690022844~exp=1690023444~hmac=26b7c002fb274457ce7ece4c4b9c778b811e7196ccff243474a1b783ece840a3`,
hobby: ["play game", "read book", "watch movie"],
};
},
methods: {
showData() {
alert(`Hello Vue, I'm ${this.name} ${this.lastName}`);
},
increaseAge() {
return this.age++;
},
decreaseAge() {
return this.age--;
},
increaseSalary(value) {
return (this.salary += value);
},
submitForm() {
alert(`We got your message : ${this.email}`);
},
toggleIsShowData() {
this.isShowData = !this.isShowData;
},
},
computed: {
getFullname() {
return `${this.name} ${this.lastName}`;
},
getJobLevel() {
return this.salary > 30000 ? "Senior" : "Junior";
}
},
watch: {
salary(value) {
if (value > 50000) {
alert("You can't get salary more than 50000");
this.salary = 50000;
this.$refs.salaryBtn.disabled = true;
}
}
},
})
app.component("Header", Header);
app.component("Footer", Footer);
app.component("SwiperComponent", SwiperComponent);
app.mount("#app");