我嘗試使用RequireJS加載JS文件,但十字路口http://millermedeiros.github.io/crossroads.js/似乎沒有正確加載。我使用Chrome Dev Toolbar進行了檢查,並且所有JS文件實際上都已加載。然而運行window.crossroad還給我undefined?無法使用RequireJS加載crossroads.js
以下是我的requirejs配置..請指教......謝謝!
的index.html
<script data-main="scripts/config" src="scripts/require.js"></script>
config.js
require.config({
shim: {
"zepto.min": {
exports: "$"
},
"underscore.min": {
exports: "_"
},
"crossroads.min": {
exports: "crossroads"
} }
});
require(["zepto.min","underscore.min", "crossroads.min",], function() {
console.log("=> Loading app")
require(["main"]);
});
main.js
require(["hp-config", "hp-model", "hp-view", "hp-controller"], function() {
console.log("=> Init");
console.log(window.crossroads);
//$(document).ready(function(){ HP.C.init(); });
});
我發現,即使window.signals是undefined – iwan