0

我为 backbonjs 视图创建了单独的文件,每个文件都有这样的代码

var appendMessageBox = Backbone.View.extend({
        initialize: function(){
            this.render();
        },
        render: function(){
            var html='myhtml'
            var template = _.template( html, {} );
            this.$el.append( template );
        }

    });

我像这样从我的插件文件中调用它

var appendMessageBox_View = new appendMessageBox({ el: jqObj });

它的工作

但是当我创建多个视图文件并调用它们时,它们不起作用

4

1 回答 1

0

你用什么来管理所有的文件?一个例子是RequireJS

也许您可以尝试在重构为不同的 js 文件之前先在一个地方运行所有源代码?

于 2013-10-22T10:09:09.543 回答