0
我想用数组的partials而且还有数组的主模板。用handlebarsjs管理partials
主要模板:
<div id="notificationsRows" class="wrapper">
{{#each notifications}}
{{>notification}}
{{/each}}
</div>
行通知:
<div class="box-container-info">
div class="thumbnail" style="background-image: url('{{image}}');"></div>
<div class="info">{{message}}</div>
</div>
如果我产生主要我可以生成:
var context = {
notifications: [{...},{...}]
}
这里没有问题,但如果我要添加更多通知我不能调用部分数组,如
var moreContextForPartial = [{...},{...}]; // This not works
我只能添加每一个像一个对象,而不是数组:
var moreContextForPartial = {...}; // This works
一些想法?
所以,用这种方式,你被软件写我可以移动的部分内的各功能,并注册partil,没有得到身体的html,这是它的缓慢。 – user1710825
如果你想要,你可以做到这一点,但在这一点上,主模板变得没用,除非你不写其他东西...... – MarcoL