以下是来自主干布局管理器的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();
答案 0 :(得分:1)
当我发布问题时,Github回答了这个问题。它应该是layout.renderTemplate()