0

我試圖使用這個骨幹擴展來製作可堆疊模式。無法插入Marionette的視圖Backbone.Modal

http://awkward.github.io/backbone.modal/

它說,與木偶兼容,所以我一直試圖與我用它創建視圖使用它。但它似乎不允許我使用生態模板和網站上的示例只有下劃線模板的問題。

對於使用生態模板所有我需要做的聲明木偶的觀點是這樣的:

class Views.ItemView extends Marionette.ItemView 
    template: "items/show/templates/item" 

但我無法定義的模板Backbone.Modal視圖類這樣,我也無法通過進入模板的視圖,我試圖使用視圖可堆疊部分,但我很迷茫。

感謝您的時間和答覆。

回答

0

如果你想使用與木偶生態模板,你需要你的意見木偶之前和之後做這樣的事情:

Backbone.Marionette.Renderer.render = (template, data) -> 
    throw "Template #{template} not found" if !JST[template] 
    JST[template](data) 

默認模板渲染假定template是一個函數,只需用的serializeData輸出和templateHelpers

調用它。如果你不想定義自定義渲染器,你應該能夠將您的模板行更改爲類似這樣:

class Views.ItemView extends Marionette.ItemView 
    template: JST["items/show/templates/item"]