-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstack-navigator.html
88 lines (81 loc) · 2.21 KB
/
stack-navigator.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<script
type="module"
src="../components/navigators/stack-navigator.js"
></script>
<style>
body {
font-family: '-apple-system', 'HelveticaNeue';
}
a {
color: #42d9c8;
font-weight: bolder;
display: block;
padding: 20px;
font-size: 24px;
}
button {
width: 200px;
margin: 51px;
height: 50px;
font-size: 20px;
}
</style>
</head>
<body style="margin:0;">
<div style="height: 100vh; width: 100vw">
<moko-stack-navigator>
<moko-route path="path1" component="demo-el1"></moko-route>
<moko-route path="path2" component="demo-el2"></moko-route>
<moko-route path="path3" component="demo-el3"></moko-route>
</moko-stack-navigator>
</div>
</body>
<script>
class Element1 extends HTMLElement {
constructor() {
super()
}
connectedCallback() {
this.style.background = '#931621'
this.style.height = '100%'
this.style.width = '100%'
this.innerHTML = `<a href="#path2">Path 1</a><a href="#path3">Path 2</a>`
}
}
customElements.define('demo-el1', Element1)
class Element2 extends HTMLElement {
constructor() {
super()
}
connectedCallback() {
this.style.background = '#28464B'
this.style.height = '100%'
this.style.width = '100%'
this.innerHTML = `<button onclick="history.back()">Back</button>`
}
}
customElements.define('demo-el2', Element2)
class Element3 extends HTMLElement {
constructor() {
super()
}
connectedCallback() {
this.style.background = '#42D9C8'
this.style.height = '100%'
this.style.width = '100%'
this.innerHTML = `<button onclick="history.back()">Back</button>`
}
}
customElements.define('demo-el3', Element3)
</script>
</html>