标签:
tree一下
.
├── aaa.html
└── js
├── jquery.min.js
├── main.js
├── myjs.js
└── require.js
aaa.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script src="js/require.js" data-main="js/main"></script> </body> </html>
main.js
requirejs.config({ urlArgs: Date.now(), //baseUrl: ‘js‘, paths: { jquery: ‘./jquery.min‘, myjs: ‘./myjs‘ } }); require([‘jquery‘,‘myjs‘], function(m1, m2) { alert(m2.getHello()); });
myjs.js
define(function () { return { getHello: function () { return ‘Hello World‘; } }; });
标签:
原文地址:http://www.cnblogs.com/ziyouchutuwenwu/p/5060805.html