Javascript sproutcore属性(@each)未更新

Javascript sproutcore属性(@each)未更新,javascript,binding,each,sproutcore,Javascript,Binding,Each,Sproutcore,我正在分析基本的应用程序 为什么当我删除StatsView(从主todos.js和todos.handlebar)时,todoListController的剩余方法(属性)停止更新自身 Todos.todoListController = SC.ArrayController.create({ ... remaining: function() { console.log('remaining');//doesn't apear in the console return

我正在分析基本的应用程序

为什么当我删除
StatsView
(从主todos.js和todos.handlebar)时,
todoListController
剩余方法(属性)停止更新自身

Todos.todoListController = SC.ArrayController.create({
  ...
  remaining: function() {
    console.log('remaining');//doesn't apear in the console
    return this.filterProperty('isDone', false).get('length');
  }.property('@each.isDone').cacheable(),
  ...
});

我可以想象,这是因为我用
StatsView
删除了绑定。但是,
@each
是否应该关注这些变化呢?

SproutCore进行了优化,尽可能少做工作。因此,当您删除StatsView时,您删除了与
.remaining
属性有关的内容。因为没有什么需要它,所以SproutCore不会计算它。这就是为什么在访问属性时应该始终使用
get()
set()
方法,以便它们可以决定是使用缓存版本还是实际计算属性