forked from RubyLouvre/avalon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index3.html
69 lines (64 loc) · 2.14 KB
/
index3.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
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="avalon.js"></script>
<script>
var obj = {
$id: "test",
array: [1, 2, 3, 4, 5],
arr: [{a: 2}, {a: 7}],
obj: {
a: 1,
b: 2,
x: 444
},
doubleArray:[[1,2,3],[4,5,6],[7,8,9]],
reset: function () {
vm.array = [Math.random(), Math.random(), Math.random(), Math.random(), Math.random()]
vm.obj = {
x: Math.random(),
y: new Date - 0,
z: 333
}
},
set: function () {
vm.arr.set(1, {a: 888})
}
}
"pop,shift,unshift,push,reverse".replace(/\w+/g, function (name) {
obj[name] = function () {
vm.array[name](name)
}
})
var vm = avalon.define(obj)
</script>
</head>
<body ms-controller="test">
<ul>
<li ms-repeat="array">{{el}}:{{$index}}:{{$last}}:{{$first}}</li>
</ul>
<ul>
<li ms-repeat="arr">{{el.a}}</li>
</ul>
<hr/>
<ul>
<li ms-repeat-eee="doubleArray">
<span ms-repeat-bbb="eee">{{bbb}}</span>
</li>
</ul>
<p>{{obj.x}}</p>
<ol>
<li ms-repeat="obj">{{$key}}:{{$val}}</li>
</ol>
<button type="button" ms-click="pop">pop</button>
<button type="button" ms-click="shift">shift</button>
<button type="button" ms-click="unshift">unshift</button>
<button type="button" ms-click="push">push</button>
<button type="button" ms-click="reverse">reverse</button>
<button type="button" ms-click="reset">reset</button>
<button type="button" ms-click="set">set</button>
</body>
</html>