获取当前所有的属性

 1 Person = Backbone.Model.extend({
 2     defaults: {
 3         name: 'Fetus',
 4         age: 0,
 5         children: []
 6     },
 7     initialize: function() {
 8         console.log('欢迎来到这个无蛋的世界!');
 9     }
10 });
11 
12 var person = new Person({
13     name: 'Thomas',
14     age: 67,
15     children: ['Ryan']
16 });
17 var attributes = person.toJSON();
18 console.log(attributes);
19 console.log(JSON.stringify(attributes));
posted @ 2012-08-16 10:23  小猩猩君  阅读(247)  评论(0编辑  收藏  举报