Home > Web Front-end > JS Tutorial > Complete example of SeaJS introductory tutorial series (3)_Seajs

Complete example of SeaJS introductory tutorial series (3)_Seajs

WBOY
Release: 2016-05-16 16:57:42
Original
952 people have browsed it

A complete example
Having said so much above, the knowledge points are relatively scattered, so in the end I plan to use a complete SeaJS example to string together these knowledge points, so that friends can summarize and review them. . This example contains the following files:

1.index.html - main page.
2.sea.js——SeaJS script.
3.init.js——init module, entry module, relies on three modules: data, jquery, and style. Loaded from the main page.
4.data.js——data module, pure json data module, loaded by init.
5.jquery.js - jquery module, a modular encapsulation of the jQuery library, loaded by init.
6.style.css - CSS style sheet, loaded by init as a style module.
7. The code of sea.js and jquery.js belongs to the library code, so I won’t go into details. Here I only give the code of the file I wrote.
html:

Copy code The code is as follows:

< ;html lang="zh-CN">



< /head>



Blog







javascript:
Copy code The 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:
Copy code The code is as follows:

.author{color:red;font-size :10pt;}
.blog{font-size:10pt;}

The operation effect is as follows:
Complete example of SeaJS introductory tutorial series (3)_Seajs
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template