1 (function () { 2 var project = './'; 3 var viewRoot = 'pages'; 4 require.config({ 5 paths: { IndexPath: project + 'pages/index', 8 ListPath: project + 'pages/list', 9 10 BusStore: project + 'model/bus.store', 11 BusModel: project + 'model/bus.model' 12 } 13 }); 14 require(['AbstractApp', 'UIHeader'], function (APP, UIHeader) { 15 window.APP = new APP({ 16 UIHeader: UIHeader, 17 viewRootPath: viewRoot 18 }); 19 window.APP.initApp(); 20 }); 21 })();
很简单的代码,指定了下require的path配置,最后我们看看入口页面的调用: