Skip to content

Commit 51cb4cf

Browse files
qitmac000408qitmac000408
authored andcommitted
对二维数组项repeat时,变换下标不能触发视图更新,并且更新前后数组长度一样时不能更新
1 parent fef2d1d commit 51cb4cf

File tree

12 files changed

+86
-22
lines changed

12 files changed

+86
-22
lines changed

avalon.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
http://weibo.com/jslouvre/
66
77
Released under the MIT license
8-
avalon.js 1.4.7 built in 2015.10.12
8+
avalon.js 1.4.7 built in 2015.10.13
99
support IE6+ and other browsers
1010
==================================================*/
1111
(function(global, factory) {
@@ -4158,6 +4158,9 @@ bindingHandlers.repeat = function (data, vmodels) {
41584158
}
41594159
}
41604160

4161+
data.handler = noop
4162+
avalon.injectBinding(data)
4163+
41614164
var elem = data.element
41624165
if (elem.nodeType === 1) {
41634166
elem.removeAttribute(data.name)
@@ -4226,7 +4229,12 @@ bindingExecutors.repeat = function (method, pos, el) {
42264229

42274230
if (data.xtype === "array") {
42284231
if (old.length === neo.length) {
4229-
return
4232+
if (old !== neo && old.length > 0) {
4233+
bindingExecutors.repeat.call(this, 'clear', pos, el)
4234+
}
4235+
else {
4236+
return
4237+
}
42304238
}
42314239
method = "add"
42324240
pos = 0

dist/avalon.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
http://weibo.com/jslouvre/
66
77
Released under the MIT license
8-
avalon.js 1.4.7 built in 2015.10.12
8+
avalon.js 1.4.7 built in 2015.10.13
99
support IE6+ and other browsers
1010
==================================================*/
1111
(function(global, factory) {
@@ -4158,6 +4158,9 @@ bindingHandlers.repeat = function (data, vmodels) {
41584158
}
41594159
}
41604160

4161+
data.handler = noop
4162+
avalon.injectBinding(data)
4163+
41614164
var elem = data.element
41624165
if (elem.nodeType === 1) {
41634166
elem.removeAttribute(data.name)
@@ -4226,7 +4229,12 @@ bindingExecutors.repeat = function (method, pos, el) {
42264229

42274230
if (data.xtype === "array") {
42284231
if (old.length === neo.length) {
4229-
return
4232+
if (old !== neo && old.length > 0) {
4233+
bindingExecutors.repeat.call(this, 'clear', pos, el)
4234+
}
4235+
else {
4236+
return
4237+
}
42304238
}
42314239
method = "add"
42324240
pos = 0

dist/avalon.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/avalon.mobile.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
http://weibo.com/jslouvre/
66
77
Released under the MIT license
8-
avalon.mobile.js 1.4.7 built in 2015.10.12
8+
avalon.mobile.js 1.4.7 built in 2015.10.13
99
support IE10+ and other browsers
1010
==================================================*/
1111
(function(global, factory) {
@@ -3476,6 +3476,9 @@ bindingHandlers.repeat = function (data, vmodels) {
34763476
}
34773477
}
34783478

3479+
data.handler = noop
3480+
avalon.injectBinding(data)
3481+
34793482
var elem = data.element
34803483
if (elem.nodeType === 1) {
34813484
elem.removeAttribute(data.name)
@@ -3544,7 +3547,12 @@ bindingExecutors.repeat = function (method, pos, el) {
35443547

35453548
if (data.xtype === "array") {
35463549
if (old.length === neo.length) {
3547-
return
3550+
if (old !== neo && old.length > 0) {
3551+
bindingExecutors.repeat.call(this, 'clear', pos, el)
3552+
}
3553+
else {
3554+
return
3555+
}
35483556
}
35493557
method = "add"
35503558
pos = 0

dist/avalon.mobile.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/avalon.mobile.old.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
http://weibo.com/jslouvre/
66
77
Released under the MIT license
8-
avalon.mobile.old.js 1.4.7 built in 2015.10.12
8+
avalon.mobile.old.js 1.4.7 built in 2015.10.13
99
support IE8 and other browsers
1010
==================================================*/
1111
(function(global, factory) {
@@ -4158,6 +4158,9 @@ bindingHandlers.repeat = function (data, vmodels) {
41584158
}
41594159
}
41604160

4161+
data.handler = noop
4162+
avalon.injectBinding(data)
4163+
41614164
var elem = data.element
41624165
if (elem.nodeType === 1) {
41634166
elem.removeAttribute(data.name)
@@ -4226,7 +4229,12 @@ bindingExecutors.repeat = function (method, pos, el) {
42264229

42274230
if (data.xtype === "array") {
42284231
if (old.length === neo.length) {
4229-
return
4232+
if (old !== neo && old.length > 0) {
4233+
bindingExecutors.repeat.call(this, 'clear', pos, el)
4234+
}
4235+
else {
4236+
return
4237+
}
42304238
}
42314239
method = "add"
42324240
pos = 0

dist/avalon.mobile.shim.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
http://weibo.com/jslouvre/
66
77
Released under the MIT license
8-
avalon.mobile.shim.js 1.4.7 built in 2015.10.12
8+
avalon.mobile.shim.js 1.4.7 built in 2015.10.13
99
==================================================*/
1010
(function(global, factory) {
1111

@@ -3475,6 +3475,9 @@ bindingHandlers.repeat = function (data, vmodels) {
34753475
}
34763476
}
34773477

3478+
data.handler = noop
3479+
avalon.injectBinding(data)
3480+
34783481
var elem = data.element
34793482
if (elem.nodeType === 1) {
34803483
elem.removeAttribute(data.name)
@@ -3543,7 +3546,12 @@ bindingExecutors.repeat = function (method, pos, el) {
35433546

35443547
if (data.xtype === "array") {
35453548
if (old.length === neo.length) {
3546-
return
3549+
if (old !== neo && old.length > 0) {
3550+
bindingExecutors.repeat.call(this, 'clear', pos, el)
3551+
}
3552+
else {
3553+
return
3554+
}
35473555
}
35483556
method = "add"
35493557
pos = 0

dist/avalon.modern.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
http://weibo.com/jslouvre/
66
77
Released under the MIT license
8-
avalon.modern.js 1.4.7 built in 2015.10.12
8+
avalon.modern.js 1.4.7 built in 2015.10.13
99
support IE10+ and other browsers
1010
==================================================*/
1111
(function(global, factory) {
@@ -3476,6 +3476,9 @@ bindingHandlers.repeat = function (data, vmodels) {
34763476
}
34773477
}
34783478

3479+
data.handler = noop
3480+
avalon.injectBinding(data)
3481+
34793482
var elem = data.element
34803483
if (elem.nodeType === 1) {
34813484
elem.removeAttribute(data.name)
@@ -3544,7 +3547,12 @@ bindingExecutors.repeat = function (method, pos, el) {
35443547

35453548
if (data.xtype === "array") {
35463549
if (old.length === neo.length) {
3547-
return
3550+
if (old !== neo && old.length > 0) {
3551+
bindingExecutors.repeat.call(this, 'clear', pos, el)
3552+
}
3553+
else {
3554+
return
3555+
}
35483556
}
35493557
method = "add"
35503558
pos = 0

dist/avalon.modern.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/avalon.modern.shim.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
http://weibo.com/jslouvre/
66
77
Released under the MIT license
8-
avalon.modern.shim.js(无加载器版本) 1.4.7 built in 2015.10.12
8+
avalon.modern.shim.js(无加载器版本) 1.4.7 built in 2015.10.13
99
support IE10+ and other browsers
1010
==================================================*/
1111
(function(global, factory) {
@@ -3476,6 +3476,9 @@ bindingHandlers.repeat = function (data, vmodels) {
34763476
}
34773477
}
34783478

3479+
data.handler = noop
3480+
avalon.injectBinding(data)
3481+
34793482
var elem = data.element
34803483
if (elem.nodeType === 1) {
34813484
elem.removeAttribute(data.name)
@@ -3544,7 +3547,12 @@ bindingExecutors.repeat = function (method, pos, el) {
35443547

35453548
if (data.xtype === "array") {
35463549
if (old.length === neo.length) {
3547-
return
3550+
if (old !== neo && old.length > 0) {
3551+
bindingExecutors.repeat.call(this, 'clear', pos, el)
3552+
}
3553+
else {
3554+
return
3555+
}
35483556
}
35493557
method = "add"
35503558
pos = 0

0 commit comments

Comments
 (0)