Aurelia阵列观察对array [index] = newItem不起作用 [英] Aurelia array observation doesn't react on array[index] = newItem
问题描述
我很惊讶为什么我的repeat.for绑定不对数组更改做出反应.然后我发现Aurelia阵列观察结果对array [index] = newItem没有反应.
I use surprised why my repeat.for binding doesn't react on array change. Then I found out Aurelia array observation doesn't react on array[index] = newItem.
这是我阅读规范时确认的 https://github.com/aurelia/binding/blob/master/test/array-observation.spec.js
This is confirmed when I read the spec https://github.com/aurelia/binding/blob/master/test/array-observation.spec.js
数组观察仅对pop/push/reverse/shift/sort/splice/unshift方法起作用.替换整个数组也可以.
The array observation only reacts on methods pop/push/reverse/shift/sort/splice/unshift. Replacing the whole array works too.
我可以使用splice
而不是使用array[index] = newItem
来解决我的问题;
I can fix my issue with splice
instead of using array[index] = newItem
;
但是我想知道对于Aurelia阵列观察,对array[index] = newItem
做出反应在技术上是否太困难了?
But I would like to know is it technically too difficult to react on array[index] = newItem
for Aurelia array observation?
推荐答案
Aurelia官方不支持此功能.
This is offcially unsupported in Aurelia.
https://github.com/aurelia/binding/issues/509
这篇关于Aurelia阵列观察对array [index] = newItem不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!