-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello-index.html
56 lines (49 loc) · 1.17 KB
/
hello-index.html
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
<!DOCTYPE html>
<html>
<head>
<title>O.js Example</title>
</head>
<body>
<div id="app"></div>
<script src="src/oo.js"></script>
<script>
class HomeComponent extends OComponent {
constructor(element) {
super(element);
this.data = {
title: 'Home',
content: 'This is the home page.'
};
}
}
class AboutComponent extends OComponent {
constructor(element) {
super(element);
this.data = {
title: 'About',
content: 'This is the about page.'
};
}
}
class ContactComponent extends OComponent {
constructor(element) {
super(element);
this.data = {
title: 'Contact',
content: 'This is the contact page.'
};
}
}
o.component('HomeComponent', HomeComponent);
o.component('AboutComponent', AboutComponent);
o.component('ContactComponent', ContactComponent);
o.route('', 'HomeComponent');
o.route('about', 'AboutComponent');
o.route('contact', 'ContactComponent');
o.setDefaultRoute('HomeComponent');
o.mount(() => {
o.navigate('');
});
</script>
</body>
</html>