Skip to content

Commit 90a7e17

Browse files
committed
update
1 parent 4c2f37c commit 90a7e17

File tree

3 files changed

+54
-21
lines changed

3 files changed

+54
-21
lines changed

dist/avalon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
built in 2017-5-9:16:4 version 2.2.7 by 司徒正美
2+
built in 2017-5-9:16:31 version 2.2.7 by 司徒正美
33
https://github.com/RubyLouvre/avalon/tree/2.2.4
44
55
修正IE下 orderBy BUG

index2.html

+41-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<title>TODO supply a title</title>
66
<meta charset="UTF-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8-
<script src='./dist/avalon.js'></script>
8+
<script src='https://cdn.bootcss.com/avalon.js/2.2.4/avalon.js'></script>
99
<style>
1010
div {
1111
width: 400px;
@@ -17,15 +17,48 @@
1717

1818
<body>
1919
<script>
20-
avalon.define({
21-
$id: 'duplex',
22-
content: ''
23-
})
20+
var vm = avalon.define({
21+
$id: "test",
22+
data: [{
23+
checked: false
24+
}, {
25+
checked: false
26+
}, {
27+
checked: false
28+
}],
29+
allchecked: false,
30+
checkAll: function(e) {
31+
var checked = e.target.checked
32+
vm.data.forEach(function(el) {
33+
el.checked = checked
34+
})
35+
},
36+
checkOne: function(e) {
37+
var checked = e.target.checked
38+
if (checked === false) {
39+
vm.allchecked = false
40+
} else {
41+
vm.allchecked = vm.data.every(function(el) {
42+
return el.checked
43+
})
44+
}
45+
}
46+
});
2447
</script>
2548

26-
<div ms-controller="duplex">
27-
<div contenteditable="true" ms-duplex="content"></div>
28-
</div>
49+
<table ms-controller="test" border="1">
50+
<tr>
51+
<td><input type="checkbox" ms-duplex-checked="@allchecked" data-duplex-changed="@checkAll" />全选</td>
52+
</tr>
53+
<tr ms-for="($index, el) in @data">
54+
<td>
55+
<input type="checkbox" ms-duplex-checked="el.checked" data-duplex-changed="@checkOne" />{{$index}}::{{el.checked}}
56+
57+
<label :dblclick="@checkOne">这一行代码 :dblclick="@checkOne" 将会吧checkbox的双向绑定给搞挂掉</label>
58+
</td>
59+
60+
</tr>
61+
</table>
2962
</body>
3063

3164
</html>

src/dom/event/share.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ avalon.bind = function(elem, type, fn) {
6262
return fn
6363
} else {
6464
/* istanbul ignore next */
65-
function cb(e){
66-
fn.call(elem, new avEvent(e))
65+
function cb(e) {
66+
fn.call(elem, new avEvent(e))
6767
}
6868
avalon._nativeBind(elem, type, cb)
6969
return cb
@@ -178,30 +178,30 @@ function delegateEvent(type) {
178178
}
179179

180180
var eventProto = {
181-
webkitMovementY:1,
181+
webkitMovementY: 1,
182182
webkitMovementX: 1,
183-
keyLocation:1,
184-
fixEvent: function () { },
185-
preventDefault: function () {
183+
keyLocation: 1,
184+
fixEvent: function() {},
185+
preventDefault: function() {
186186
var e = this.originalEvent || {}
187187
e.returnValue = this.returnValue = false
188188
if (modern && e.preventDefault) {
189189
e.preventDefault()
190190
}
191191
},
192-
stopPropagation: function () {
192+
stopPropagation: function() {
193193
var e = this.originalEvent || {}
194194
e.cancelBubble = this.cancelBubble = true
195195
if (modern && e.stopPropagation) {
196196
e.stopPropagation()
197197
}
198198
},
199-
stopImmediatePropagation: function () {
199+
stopImmediatePropagation: function() {
200200
this.stopPropagation()
201201
this.stopImmediate = true
202202
},
203-
toString: function () {
204-
return '[object Event]'//#1619
203+
toString: function() {
204+
return '[object Event]' //#1619
205205
}
206206
}
207207

@@ -223,8 +223,8 @@ export function avEvent(event) {
223223
this.originalEvent = event
224224
}
225225
avEvent.prototype = eventProto
226-
//针对firefox, chrome修正mouseenter, mouseleave
227-
/* istanbul ignore if */
226+
//针对firefox, chrome修正mouseenter, mouseleave
227+
/* istanbul ignore if */
228228
if (!('onmouseenter' in root)) {
229229
avalon.each({
230230
mouseenter: 'mouseover',

0 commit comments

Comments
 (0)