1.js | |
|---|---|
| در این آموزش، شما یک نمونه از عملیات اجرایی را در غالب یک View ساده مشاهده خواهید کرد. | |
| اجرا خود به خود عملیات | (function($){ |
| ListView class: این کلاس، View اصلی برنامه میباشد. | var ListView = Backbone.View.extend({
el: $('body'), // attaches `this.el` to an existing element. |
|
| initialize: function(){
_.bindAll(this, 'render'); // fixes loss of context for 'this' within methods
this.render(); // not all views are self-rendering. This one is.
}, |
|
| render: function(){
$(this.el).append("<ul> <li>hello world</li> </ul>");
}
}); |
| نمونه listView: نمونه ی اصلی برنامه. | var listView = new ListView();
})(jQuery); |
![]() | |