文件结构如图:
用F5刷新页面间歇性出错:
demo.html代码:
seajs Hello World
hello.js代码:
define(function(require, exports, module) { var $ = require('jquery') function Hello(){ this.render() } Hello.prototype.render = function(){ $('Hello SeaJS !
').appendTo('body').fadeIn(2000) } return Hello});
main.js代码:
seajs.config({ alias: { 'jquery': '/script/libs/jquery.js' }});
page.js代码:
seajs.use(['/script/hello'], function(Hello) { new Hello()});