forked from RubyLouvre/avalon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepeat1.html
68 lines (67 loc) · 2.2 KB
/
repeat1.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
<!DOCTYPE HTML>
<html>
<head>
<title>ms-repeat</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="../avalon.js" ></script>
<script>
var vmodel = avalon.define("test", function(vm) {
vm.first = {
array: ["aaa", "bbb", "ccc", "ddd"],
text: "初次赋值",
object: {
banana: "香蕉",
apple: "苹果",
peach: "桃子",
pear: "雪梨"
}
}
})
setTimeout(function() {
vmodel.first = {
array: ["@@@", "###", "$$$", "%%%"],
text: "<span style='color:red;'>再次赋值</span>",
object: {
grape: "葡萄",
coconut: "椰子",
pitaya: "火龙果",
orange: "橙子"
}
}
}, 3000)
</script>
</head>
<body ms-controller="test">
<p>要循环的数组位于一个对象上,然后对这个数组进行{{first.text|html}}</p>
<fieldset>
<legend>ms-repeat</legend>
<table width="100%">
<tr>
<td>
<ul>
<li ms-repeat="first.array">{{el}}</li>
</ul>
</td>
<td>
<ol>
<li ms-repeat="first.object">{{$key}}: {{$val}}</li>
</ol>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>ms-each</legend>
<ul ms-each="first.array">
<li>{{el}}</li><li>-----</li>
</ul>
</fieldset>
<fieldset>
<legend>ms-with</legend>
<ul ms-with="first.object">
<li>{{$key}}: {{$val}}</li>
</ul>
</fieldset>
</body>
</html>