此截屏视频:http ://www.embercasts.com/episodes/getting-started-with-ember-model用于Ember.model
创建这样的人物模型:
App.Person = Ember.Model.extend({
name : Ember.attr()
})
文档给出了这个例子Ember.Object
App.Person = Ember.Object.extend({
say : function(thing) {
alert(thing);
}
});
此外,在定义模型部分给出了这个例子,它使用DS.model
App.Person = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
birthday: DS.attr('date'),
fullName: function() {
return this.get('firstName') + ' ' + this.get('lastName');
}.property('firstName', 'lastName')
});
这三个有什么区别,什么时候用哪个?