-
Notifications
You must be signed in to change notification settings - Fork 221
/
avalon.mmPromise.ex1.html
49 lines (46 loc) · 1.52 KB
/
avalon.mmPromise.ex1.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
<!DOCTYPE html>
<html>
<head>
<title>Promise组件</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<link type="text/css" rel="stylesheet" href="../style/avalon.doc.css">
<script src="../avalon.js">
</script>
<script src="../highlight/shCore.js">
</script>
<script>
require(["mmPromise/mmPromise","domReady!"], function() {
var _resolve
new Promise(function(resolve){
_resolve = resolve
}).then(function(a){
vmodel.array.push(a)
return a + 10
}).then(function(a){
vmodel.array.push(a)
return a + 10
}).then(function(a){
vmodel.array.push(a)
return a + 10
}).then(function(a){
vmodel.array.push(a)
return a + 10
})
var vmodel = avalon.define("test", function(vm) {
vm.click = function(){
_resolve(1000)
}
vm.array = ["准备开始"]
})
avalon.scan()
})
</script>
</head>
<body ms-controller="test">
<ul>
<li ms-repeat="array">{{el}}</li>
</ul>
<p><button ms-click="click" type="button">点我开始</button></p>
</body>
</html>