Backbone布局管理器 - 渲染未调用

时间:2013-08-28 11:59:52

标签: backbone.js backbone-layout-manager

以下是来自主干布局管理器的github的示例代码。 该视图的自定义渲染未被调用/它不会在断点处停止。发生了什么。

   // Create a Content view to be used with the Layout below.
    var ContentView = Backbone.Layout.extend({
      template: "#content"
    });

    // Create a new Layout with a sub view for content.
    var layout = new Backbone.Layout({
      template: "#layout",

      // This will place the contents of the Content View into the main
      // Layout's <p></p>.
      views: {
        // Appending a new content view using the array syntax
        p: new ContentView({
          // Custom render function that reverses everything.
          render: function(template, context) {
            return template(context).split("").reverse().join("");
          }
        })
      }
    });

    // Attach the Layout to the main container.
    layout.$el.appendTo(".main");

    // Render the Layout.
    layout.render();

1 个答案:

答案 0 :(得分:1)

当我发布问题时,Github回答了这个问题。它应该是layout.renderTemplate()