我是Backbone新手,需要js。 如果有任何错误,请查看我的init.js,因为它不起作用。 另外,请为同一目的建议任何其他方法。 我在我的本地主机上运行它。
这是我的init.js文件,我从index.html调用data-main。
requirejs.config({
waitSeconds: 200,
paths:{
'jquery':'./jquery',
'backbone':'./backbone',
'underscore':'./underscore'
},
shim:{
'backbone': {
dep: ['underscore,jquery']
},
'bootstrap':{
dep: ['jquery']
}
}
});
require([
"jquery",
"underscore",
"backbone",
"handlebars",
"bootstrap",
"text"
], function ($, _, Backbone, Handlebars, Bootstrap, text) {
});
require(["../routes/router"], function () {
Backbone.history.start();
console.log('history started');
});
在此图片See this
中可以看到ExactError答案 0 :(得分:0)
Backbone在一段时间内不需要shim
。所以你应该删除它。此外,您应使用的字段是deps
,而不是dep
。所以你的最终shim
应该是:
shim:{
'bootstrap':{
deps: ['jquery']
}
}