-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
56 lines (52 loc) · 1.56 KB
/
test.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
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="My.js"></script>
</head>
<body>
<div><a href="">11111</a></div>
<div><a href="">22222</a></div>
<div id="formbox"></div>
<canvas id="mycanvas" style="border:1px solid #c3c3c3;">哈哈哈哈哈</canvas>
</body>
<script type="text/javascript">
var provider = new My.DataProvider([
[1, 2, 3]
]);
provider.on({
'change:0': function() {
debugger
},
'unset': function(evt) {
debugger
}
});
var home = new M.Model('',null, {
name: 'luoying',
wife: 'liyanyan',
son: 'luolinan'
});
var HomeView = M.View.extend({
tpl: '<form><div><input name="name" value="{name}"></div><div><input name="wife" value="{wife}"></div><div><input name="son" value="{son}"></div><div><input type="submit"></div></form>',
events: {
'submit form': function(evt) {
evt.preventDefault();
},
'change? input': function(evt, view) {
debugger
view.model.set(this.name, this.value);
}
},
initialize: function() {
this.model.on('change', function() {
debugger
});
}
});
var hv = new HomeView('#formbox', home);
M.canvas.wrap('#mycanvas').attr({
'fillStyle': '#FF0000'
}).beginPath().arc(70, 18, 15, 0, Math.PI * 2, true).closePath().fill().unwrap();
</script>
</html>