【发布时间】:2012-07-10 20:36:16
【问题描述】:
KnockoutJS中的dependenant observables和computed observables有什么区别吗?
我的理解是 computed observables 是 dependent observables 的继承者(在新版本的 Knockout 中基本上只是不同的名称) - 但是网络上的一些教程使用一个和一些使用另一个。
有人可以一劳永逸地回答这个问题吗?
【问题讨论】:
KnockoutJS中的dependenant observables和computed observables有什么区别吗?
我的理解是 computed observables 是 dependent observables 的继承者(在新版本的 Knockout 中基本上只是不同的名称) - 但是网络上的一些教程使用一个和一些使用另一个。
有人可以一劳永逸地回答这个问题吗?
【问题讨论】:
同样的,在淘汰赛 2.0 中更改了名称。较早的示例可能使用旧名称。
见:http://knockoutjs.com/documentation/dependentObservables.html
来自 Knockout 的文档:
在运行时,ko.dependentObservable 指的是同一个函数 ko.computed,因此您现有的代码将继续正常工作。
【讨论】: