摘要:
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 3 <head> 4 <meta http-equiv="Content-Type" co 阅读全文
摘要:
1 Person = Backbone.Model.extend({ 2 //如果从validate中返回字符串了,Backbone就会抛个实例异常 3 validate: function(attributes) { 4 if (attributes.age < 0 && attributes.name != "Dr Manhatten") { 5 return '你的存在是个错误'; 6 } 7 }, 8 initialize: function() { 9 console.log('... 阅读全文
摘要:
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: ['R... 阅读全文