script // Utils.js define(function() { var Utils = {}; Utils.doSomething = function() { } return Utils; }); script // App.js define(['Utils'], function(Utils) { var App = {}; App.init = function() { Utils.doSomething(); } return App; }); html <!-- index.html --> <!DOCTYPE html> <html> <head> <script src="require.js" data-main="main"></script> </head> <body> </body> </html> script // require.config.js require.config({ paths: { 'App': 'app/App' } });


上一篇:
下一篇:
切换中文