首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >require.js 'Backbone‘仅为未定义的IE

require.js 'Backbone‘仅为未定义的IE
EN

Stack Overflow用户
提问于 2012-09-25 23:07:21
回答 1查看 1.7K关注 0票数 2

站点在所有浏览器中都能完美运行,但IE: SCRIPT5009:'Backbone‘未定义

这就是main.js,它已经花费了很多小时,似乎满足了所有的应用编程接口要求?

代码语言:javascript
运行
复制
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){});
    }


});

和我的定义调用:

代码语言:javascript
运行
复制
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");
        }
    });
});

任何帮助都是最好的.谢谢

EN

回答 1

Stack Overflow用户

发布于 2013-01-25 22:09:25

我知道这不是你所期望的解决方案,但是我在IE10上遇到了同样的错误。问题是,在较老的ie版本(ie9,8,7,6)中,它工作得很好,所以我决定使用官方的MS 'hack‘- X-UA-Compatible

只需将以下行添加到您的html的<head>部分:

代码语言:javascript
运行
复制
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />

希望它能帮上忙!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12585850

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档