【问题标题】:Render only template wrapper Backbone.Marionette.CompositeView仅渲染模板包装器 Backbone.Marionette.CompositeView
【发布时间】:2015-11-26 22:44:30
【问题描述】:

我有一个带有标题(选择过滤器)的模板和带有集合模型列表的部分。视图 (Backbone.Marionette.CompositeView) 总是在第一次加载模板包装器和模型时自动呈现。

有没有办法在第一次加载时只渲染模板包装器?

【问题讨论】:

    标签: backbone.js render marionette


    【解决方案1】:

    没有。但您可以随时切换模板。

    initialize: function(){
        this.template = template1(); // initial render will use template 1
    },
    onRender: function(){
        this.template = template2(); // point to template 2 after every render. So each subsequesnt render will use template 2.
    },
    doStuff: function(){
        this.render(); // call render when doing stuff
    }
    

    【讨论】:

    • 它没有帮助。它只是在不同的地方渲染这些模型。
    • 好吧,如果不提供一些代码,就很难提供帮助。我想知道你尝试了什么。
    猜你喜欢
    • 2015-06-11
    • 2010-11-30
    • 1970-01-01
    • 1970-01-01
    • 2013-01-10
    • 2010-10-28
    • 1970-01-01
    • 1970-01-01
    • 2016-11-13
    相关资源
    最近更新 更多