Backbone.js 未捕获的TypeError:$不是在另一个视图中调用主干视图时的函数

Backbone.js 未捕获的TypeError:$不是在另一个视图中调用主干视图时的函数,backbone.js,Backbone.js,我有这个主干视图,当这个页面被呈现时,子页面中的一个小内容也会呈现到父页面 父页面 define([ 'jquery', 'underscore', 'backbone', 'text!../../../../school-admin/studentHealthRecord.html', 'views/schoolModule/viewStudentHealthView' ], function ( $, _, Backbone,

我有这个主干视图,当这个页面被呈现时,子页面中的一个小内容也会呈现到父页面

父页面

define([ 
    'jquery',
    'underscore',
    'backbone',
    'text!../../../../school-admin/studentHealthRecord.html',
    'views/schoolModule/viewStudentHealthView'
], function (
    $,
    _,
    Backbone,
    healthRecordTemplate,
    ViewStudentHealthView
) {

    var StudentHealthRecordView = Backbone.View.extend({
        // target item.
        el : $("#schoolContentOuterPnl"),

        render : function() {
            var data = {};
            // template
            var healthcompiledTemplate =  _.template(healthRecordTemplate, data);
            // append the item to the view's target
            this.$el.html(healthcompiledTemplate);
            this.viewHealthClickEvent();
        },

        // Event Handlers
        events : {
        },

        viewHealthClickEvent : function(){
            new ViewStudentHealthView({
                el : $("#divSchoolHealthViewEdit")
            });
        },
    });

    return new StudentHealthRecordView;

});
define([
    'jquery',
    'underscore',
    'backbone',
    'text!../../../../school-admin/viewHealthRecord.html'
], function(
    $,
    _,
    Backbone,
    ViewStudentHealthTemplate
) {

    var ViewStudentHealthView = Backbone.View.extend({
        initialize: function(){
            this.render();
        },

        render : function() {
            // template
            var data = {};
            var ViewStudentHealthCompiledTemplate = _.template(ViewStudentHealthTemplate, data);
            // append the item to the view's target

            this.$el.html(ViewStudentHealthCompiledTemplate);
        },
        // Event Handlers
        events : {      
        }

    });

    return new ViewStudentHealthView;
});
子页面

define([ 
    'jquery',
    'underscore',
    'backbone',
    'text!../../../../school-admin/studentHealthRecord.html',
    'views/schoolModule/viewStudentHealthView'
], function (
    $,
    _,
    Backbone,
    healthRecordTemplate,
    ViewStudentHealthView
) {

    var StudentHealthRecordView = Backbone.View.extend({
        // target item.
        el : $("#schoolContentOuterPnl"),

        render : function() {
            var data = {};
            // template
            var healthcompiledTemplate =  _.template(healthRecordTemplate, data);
            // append the item to the view's target
            this.$el.html(healthcompiledTemplate);
            this.viewHealthClickEvent();
        },

        // Event Handlers
        events : {
        },

        viewHealthClickEvent : function(){
            new ViewStudentHealthView({
                el : $("#divSchoolHealthViewEdit")
            });
        },
    });

    return new StudentHealthRecordView;

});
define([
    'jquery',
    'underscore',
    'backbone',
    'text!../../../../school-admin/viewHealthRecord.html'
], function(
    $,
    _,
    Backbone,
    ViewStudentHealthTemplate
) {

    var ViewStudentHealthView = Backbone.View.extend({
        initialize: function(){
            this.render();
        },

        render : function() {
            // template
            var data = {};
            var ViewStudentHealthCompiledTemplate = _.template(ViewStudentHealthTemplate, data);
            // append the item to the view's target

            this.$el.html(ViewStudentHealthCompiledTemplate);
        },
        // Event Handlers
        events : {      
        }

    });

    return new ViewStudentHealthView;
});

当父页面初始化时,子页面也应该初始化,但是它显示$is不是一个函数。

a
]
父页面的
定义
的依赖项列表中丢失了一个
,这是打字错误吗?这是一个错误,实际上]我忘记添加了。顺便问一下,为什么返回视图的
实例
,而不是
视图
本身-在两个视图的
返回
行中?模块应该返回
视图
引用本身,而不是类。我不确定这是否仍然是一个悬而未决的问题,这里有一个正确显示视图的JSFIDLE,正如@Cyclone提到的,您错误地返回了视图的实例,而不仅仅是引用,如
返回ViewStudentHealthView,如果此问题已解决,请标记为已解决。是的,我删除了新关键字。但它仍然显示$is在新视图HealthRecordView上不起作用({el:this.$(“#schoolContentOuterPnl”)});