This article mainly introduces the complete example of the Seajs Introductory tutorial series, demonstrates a complete SEAJS development example, and needs a friend to refer to the following
A complete example above said so much, the knowledge point is more dispersed, therefore finally I intend to use a complete seajs example to put these knowledge points together, facilitates the friend to generalize the review. This example includes the following file: 1.index.html--homepage. 2.sea.js--seajs script. 3.init.js--init module, Portal module, relies on data, jquery, style three modules. Loaded by the master page. 4.data.js--data module, pure JSON data module, loaded by init. 5.jquery.js--jquery module, modular encapsulation of the jquery library, loaded by init. The 6.STYLE.CSS--CSS style sheet, which is loaded as a style module by init. 7.sea.js and Jquery.js code belong to the library code, do not repeat, here only give the code of the file you write. HTML: code is as follows: <! DOCTYPE html> <html lang= "ZH-CN" > <head> <meta charset= "UTF-8" > <TITL e></title> </head> <body> <div id= "Content" > <p class= "Author" ></p > <p class= "blog" ><a href= "#" >Blog</a></p> </div> <script src= "./sea.js" data-main= "./init" ></script> </body> </html> javascript: Code is as follows://init.js define (function (Require, exports, module) { var $ = require ('./jquery '); var data = require ('./data ') ); var css = rEquire ('./style.css '); $ ('. Author '). html (Data.author); $ ('. Blog '). attr (' href ', data.blog); }); //data.js define ({ author: ' Zhangyang ', blog: ' http://blog.codinglabs.org '}); CSS: code as follows:. author{color:red;font-size:10pt; blog{font-size:10pt;}