站点在所有浏览器中都能完美运行,但IE: SCRIPT5009:'Backbone‘未定义
这就是main.js,它已经花费了很多小时,似乎满足了所有的应用编程接口要求?
requirejs.config({
paths: {
// "jquery" : "jquery-1.7.2.min",
"jquery.json" : "jquery.json-2.3.min",
"jquery.jtemplates" : "jquery-jtemplates",
"jquery.nailthumb" : "jquery.nailthumb.1.1.min",
"jquery.ui" : "jquery-ui-1.8.21.custom.min",
"jquery.fileupload" : "jquery-fileupload/jquery.fileupload",
"jquery.iframe-transport" : "jquery-fileupload/jquery.iframe-transport",
"jquery.ui.widget" : "jquery-fileupload/vendor/jquery.ui.widget",
"jquery.fancybox" : "jquery.fancybox",
"handlebars" : "handlebars",
"input" : "input",
"validator" : "cars/modules/carsValidator",
"backbone" : "backbone",
"underscore": "underscore"
},
shim: {
'jquery.jtemplates': {
deps: ['jquery']
},
//exports: "jQuery.fn.setTemplate"
//},
'jquery.json': {
deps: ['jquery'],
exports: "JSON"
},
'jquery.nailthumb':{
deps: ['jquery']
},
'jquery.iframe-transport':{
deps: ['jquery']
},
'jquery.fancybox':{
deps: ['jquery']
},
'input': {
deps: ['jquery']
},
'backbone': {
deps: ['jquery', 'underscore'],
exports: "Backbone"
},
'underscore' :{
exports: '_'
}
}
});
requirejs(["jquery"], function($) {
window.$ = $;
if (typeof console == "undefined") {
this.console = {log: function() {}};
}
//this will invoke the script for the page
if (module){
require([module], function(module){});
}
});和我的定义调用:
define(["jquery", "backbone"], function ($, backbone) {
return backbone.Model.extend({
update: function (message) {
return this.type(message.type).message(message.message);
},
type: function (type) {
if (type) {
this.set({type: type});
return this;
}
return this.get("type");
},
message: function (message) {
if (message) {
this.set({message: message});
return this;
}
return this.get("message");
}
});
});任何帮助都是最好的.谢谢
发布于 2013-01-25 22:09:25
我知道这不是你所期望的解决方案,但是我在IE10上遇到了同样的错误。问题是,在较老的ie版本(ie9,8,7,6)中,它工作得很好,所以我决定使用官方的MS 'hack‘- X-UA-Compatible。
只需将以下行添加到您的html的<head>部分:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />希望它能帮上忙!
https://stackoverflow.com/questions/12585850
复制相似问题