Backbone.js 使用RequireJS在视图中注入其他Bacbone模型

Backbone.js 使用RequireJS在视图中注入其他Bacbone模型,backbone.js,backbone-events,backbone-model,Backbone.js,Backbone Events,Backbone Model,我正在学习RequireJS的主干,在我的视图中实例化其他模型时遇到了一个问题。我有两个事件调用不同的方法。不同的方法或多或少地使用不同的模型和子视图。上面的示例将放置在新的模型实例上 TypeError: GridsModel is not a constructor var gridModel = new GridsModel; 当使用网格法时 我的代码看起来像 /*global define*/ define([ 'jquery', 'underscore',

我正在学习RequireJS的主干,在我的视图中实例化其他模型时遇到了一个问题。我有两个事件调用不同的方法。不同的方法或多或少地使用不同的模型和子视图。上面的示例将放置在新的模型实例上

TypeError: GridsModel is not a constructor
    var gridModel = new GridsModel;
当使用网格法时

我的代码看起来像

/*global define*/

define([
    'jquery',
    'underscore',
    'backbone',
    'templates',
    'jqueryui',
    'models/grids',
    'views/grids',
    'views/modal'
], function ($, _, Backbone, JST, GridsModel, GridsView, ModalView) {
    'use strict';

    var EditorView = Backbone.View.extend({
        template: JST['app/scripts/templates/editor.ejs'],

        tagName: 'div',

        el: '.container',

        id: '',

        className: '',

        events: {
            "click button.expand" : "controlToggle",
            "click .row-edit" : "edit",
            "click .grid" : "grid",
            "click .delete" : "delete",
            "click .components" : "components",
        },

        initialize: function () {
            var gridModel = new GridsModel;
            var body = $('body')
            var rows = body.find('.row')

            console.log(this.model)
            $.each(rows, function(e , v){
                if(v.length > 0)
                    console.log(v)
                    //$(this).parent().addClass('editor-row')
                else
                    //console.log($(this))
                    $(this).addClass('editor-row empty-row')

            })

        $('.ui-sortable').sortable({ handle: 'button.row-handle' })
            this.listenTo(this.model, 'change', this.render);

        this.listenTo(this.model, 'change', this.render);

        },

        render: function () {
            this.$el.html(this.template(this.model.toJSON()));

        },

        controlToggle: function(e){
            var controlls =  $(e.currentTarget).closest('.editor-controls')
            $(controlls).find('.active').removeClass('active')
            $(e.currentTarget).parent().addClass('active')
        },

        edit: function(){

        },

        delete: function() {

            confirm('Press OK to delete section, Cancel to leave')

        },

        grid: function() {

            this.model = new GridsModel({
                 'title': 'Edit Grids'
            })

            var gridView = new GridsView({
                model: this.model 
            })

            var grids = new ModalView({
               model : this.model,
               subview: gridView
        }).render()


        },

        components: function() {
            this.model = new Fefe.Models.Components({
                'title': 'Add Component'
            })

            var componentsView = new Fefe.Views.Components({
                model: this.model 
            })

            var components= new Fefe.Views.Modal({
                model : this.model,
                className: 'modal large',
                subview: componentsView
            }).render()
        }

    });

    return EditorView;
});

这里我做错了什么

jqueryui
在define块中,但不在函数的参数列表中。这应该关闭,因为这是一个简单的印刷错误。