This article mainly introduces the JavascriptMVC framework Backbone. js details, this article on Backbone. the actual examples are provided for various modules and methods of js. As JavaScript programs become more and more complex, you may need a team for collaborative development, at this time, code modularization and organization specifications become very important. The MVC mode is the classic mode of code organization.
(...... MVC introduction .)
(1) Model
Model indicates the data layer, that is, the data source required by the program, which is usually expressed in JSON format.
(2) View
View indicates the presentation layer, that is, the user interface. For a webpage, It is the HTML code of the webpage that the user sees.
(3) Controller
Controller indicates the control layer, which is used to process the raw data (Model) and transmit it to the View.
Because Web programming is different from client programming, based on MVC, the JavaScript community generates various variant frameworks, such as Model-View-Presenter and MVVM (Model-View-ViewModel, some people refer to the various models of this framework as MV *.
The Framework has the advantage of organizing code reasonably, facilitating team cooperation and future maintenance. The disadvantage is that there is a certain learning cost, and you can only adopt the method.
Loading of Backbone
The Code is as follows: