1

这是来自主干布局管理器 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();
4

1 回答 1

1

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

于 2013-09-03T10:12:11.593 回答