App.Person = Ember.Object.extend({
// these will be supplied by `create`
firstName: null,
lastName: null,
fullName: function() {
return this.get('firstName') + ' ' + this.get('lastName');
}.property('firstName', 'lastName'),
fullName:Ember.computed('firstName','lastName', function() {
return this.get('firstName') + ' ' + this.get('lastName');
}
});
函数Ember.computed()或function()。property()有什么区别?
为什么有两种方法(函数)将函数声明为计算属性? 有什么区别,好处?
答案 0 :(得分:1)
Ember.computed()
是{干净的} disabling prototype extensions到function().property()
。