-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
35 lines (35 loc) · 972 Bytes
/
Copy pathindex.html
File metadata and controls
35 lines (35 loc) · 972 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="minirouter.js"></script>
</head>
<body>
<div id="app">hi</div>
<script>
var router = new Router('#app');
router.use('/', {
render: function(){
return '<div><h4>page1</h4><p><a href="#/baidu">a path does not exist<a><br/><a href="#/page2">#page2</a></p></div>';
},
onEnter: function(){
alert("hi here, i'm page1");
},
onLeave: function(){
alert('goodbye page1');
}
}).use('/page2', {
render: function(){
return '<div><h4>page2</h4></div>';
},
onEnter: function(){
alert('hi page2');
},
onLeave: function(){
alert('bye page2');
}
}).default('/').run();
</script>
</body>
</html>