-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
55 lines (51 loc) · 1.74 KB
/
index.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
import { html, GApp, $ref } from "./core/index.js"
import Sui from "./components/index.js"
import createRouter from "./router.js";
function App(){
const root = $ref();
root.onLoad( e => {
const useRouter = createRouter({
debug: true,
root: e,
routes: {
'/a': {
keepMounted: false,
accessibleRoutes: ['/b', '/c',],
page: () => html`a`
},
'/b': {
keepMounted: false,
accessibleRoutes: ['/c',],
page: () => html`b`
},
'/c': {
accessibleRoutes: ['/a', '/e'],
page: ({ a }) => {
console.log( a )
const page =
html`
<h1>
${a}
</h1>
`
console.log( page )
return page;
}
},
'/e': {
accessibleRoutes: ['/a'],
page: () => html`c`
},
},
default: '/a'
});
})
return html`
<div ref=${root}></div>
`
}
GApp
.use(Sui)
.createRoot(
App(), document.body
)