-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
index2.html
64 lines (58 loc) · 1.79 KB
/
index2.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
<!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='https://cdn.bootcss.com/avalon.js/2.2.4/avalon.js'></script>
<style>
div {
width: 400px;
height: 200px;
border: 1px #000 solid;
}
</style>
</head>
<body>
<script>
var vm = avalon.define({
$id: "test",
data: [{
checked: false
}, {
checked: false
}, {
checked: false
}],
allchecked: false,
checkAll: function(e) {
var checked = e.target.checked
vm.data.forEach(function(el) {
el.checked = checked
})
},
checkOne: function(e) {
var checked = e.target.checked
if (checked === false) {
vm.allchecked = false
} else {
vm.allchecked = vm.data.every(function(el) {
return el.checked
})
}
}
});
</script>
<table ms-controller="test" border="1">
<tr>
<td><input type="checkbox" ms-duplex-checked="@allchecked" data-duplex-changed="@checkAll" />全选</td>
</tr>
<tr ms-for="($index, el) in @data">
<td>
<input type="checkbox" ms-duplex-checked="el.checked" data-duplex-changed="@checkOne" />{{$index}}::{{el.checked}}
<label :dblclick="@checkOne">这一行代码 :dblclick="@checkOne" 将会吧checkbox的双向绑定给搞挂掉</label>
</td>
</tr>
</table>
</body>
</html>