forked from RubyLouvre/avalon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtree.html
45 lines (44 loc) · 1.69 KB
/
tree.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
<!DOCTYPE HTML>
<html>
<head>
<title>树</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="avalon.$events.js" ></script>
<script>
avalon.define("tree", function(vm) {
vm.tree = [
{text: "aaa", subtree: [
{text: 1111, subtree: []},
{text: 2222, subtree: [
{text: 777, subtree: []}
]},
{text: 3333, subtree: [
{text: 8888, subtree: []},
{text: 999, subtree: []}
]}
]},
{text: "bbb", subtree: [
{text: 4444, subtree: []},
{text: 5555, subtree: []},
{text: 6666, subtree: []}
]},
{text: "ccc", subtree: []},
{text: "ddd", subtree: []},
{text: "eee", subtree: []},
{text: "fff", subtree: []}
]
})
</script>
</head>
<body ms-controller="tree">
<script type="avalon" id="tmpl">
<ul ms-each-el="el.subtree">
<li>{{el.text}}<div ms-include="'tmpl'" ms-visible="el.subtree.length" ></div></li>
</ul>
</script>
<ul ms-each-el="tree">
<li>{{el.text}}<div ms-include="'tmpl'" ms-visible="el.subtree.length" ></div></li>
</ul>
</body>
</html>