Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Backbone.js 带RequireJS和BackboneJS的手柄编译_Backbone.js_Requirejs_Handlebars.js - Fatal编程技术网

Backbone.js 带RequireJS和BackboneJS的手柄编译

Backbone.js 带RequireJS和BackboneJS的手柄编译,backbone.js,requirejs,handlebars.js,Backbone.js,Requirejs,Handlebars.js,requirejs配置: require.config({ baseUrl: '/js/', paths: { jquery: './libs/jquery/jquery-1.10.1.min', underscore: './libs/underscore/underscore-min', backbone: './libs/backbone/backbone-min', handlebars: './libs/h

requirejs配置:

require.config({
    baseUrl: '/js/',
    paths: {
        jquery: './libs/jquery/jquery-1.10.1.min',
        underscore: './libs/underscore/underscore-min',
        backbone: './libs/backbone/backbone-min',
        handlebars: './libs/handlebars/handlebars',
        templates: '/templates'
    },

    shim: {
        underscore: {
            exports: '_'
        },

        backbone: {
            deps: ['jquery', 'underscore'],
            exports: 'Backbone'
        }
    }
});
shim: {
  handlebars: {
    exports: 'Handlebars'
  },
视图:

我遇到了以下错误:

Uncaught TypeError: Cannot call method 'compile' of undefined.

将此添加到您的垫片配置:

require.config({
    baseUrl: '/js/',
    paths: {
        jquery: './libs/jquery/jquery-1.10.1.min',
        underscore: './libs/underscore/underscore-min',
        backbone: './libs/backbone/backbone-min',
        handlebars: './libs/handlebars/handlebars',
        templates: '/templates'
    },

    shim: {
        underscore: {
            exports: '_'
        },

        backbone: {
            deps: ['jquery', 'underscore'],
            exports: 'Backbone'
        }
    }
});
shim: {
  handlebars: {
    exports: 'Handlebars'
  },

将此添加到您的垫片配置:

require.config({
    baseUrl: '/js/',
    paths: {
        jquery: './libs/jquery/jquery-1.10.1.min',
        underscore: './libs/underscore/underscore-min',
        backbone: './libs/backbone/backbone-min',
        handlebars: './libs/handlebars/handlebars',
        templates: '/templates'
    },

    shim: {
        underscore: {
            exports: '_'
        },

        backbone: {
            deps: ['jquery', 'underscore'],
            exports: 'Backbone'
        }
    }
});
shim: {
  handlebars: {
    exports: 'Handlebars'
  },

如何加载预编译模板?@chovy,我使用requirejs handelbarsplugin@chovy我想我用过这个——幸运的是,你加载预编译模板了吗?@chovy,我用的是requirejs handelbarsplugin@chovy我想我用过这个祝你好运