forked from RubyLouvre/avalon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavalon.live.html
70 lines (66 loc) · 2.47 KB
/
avalon.live.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
70
<!DOCTYPE html>
<html>
<head>
<title>ms-live</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
.red { color:#f00; }
</style>
</head>
<body >
<div ms-controller="model">
<div ms-html="aaa" ms-live-click="live"></div>
<ul ms-each="array">
<li ms-live-click="getIndex">{{$index}}</li>
</ul>
<input ms-live-focus="focus" ms-live-blur="blur" />
<input type="radio" name="aaa" ms-live-change="check" value="111"/><input ms-live-change="check" type="radio" name="aaa" value="222"/>
<input ms-live-change="check" value="xxxx"/> <input ms-live-change="check" value="xxxx" type="password"/>
<textarea ms-live-change="check">dddd</textarea>
<select ms-live-change="check">
<option>1111</option>
<option>2222</option>
<option>3333</option>
</select>
<select ms-live-change="check" multiple>
<option>1111</option>
<option>2222</option>
<option>3333</option>
</select>
<div>{{show}}</div>
</div>
<script src="avalon.js" type="text/javascript"></script>
<script>
require("avalon.live", function() {
var model = avalon.define("model", function(vm) {
vm.aaa = "<b>ddd</b>"
vm.live = function(e) {
avalon.log(this)
avalon.log(e.target)
}
vm.array = ["a", "b", "c", "d"]
vm.show = ""
vm.getIndex = function() {
vm.show = this.innerHTML
}
vm.focus = function(e) {
vm.show = e.type
}
vm.check = function(e) {
vm.show = e.type + " " + avalon(this).val()
}
vm.blur = function(e) {
vm.show = e.type
}
});
setTimeout(function() {
model.aaa = "<em>dddd</em>"
}, 3000)
setTimeout(function() {
model.aaa = "<em>3333</em>"
}, 4000)
avalon.scan()
})
</script>
</body>
</html>