<div id="metro-scrollbar" data-bind="foreach: data.sections , visible: data.sections.length > 0">
<section data-bind="foreach: $data.tiles, visible: $data.tiles.length > 0, css: { 'last' : $parent.isLastSection($index)}">
<div data-bind="attr : {'class' : $root.getClass($data,$parentContext.$index,$index)} ">
<div data-bind="attr : {'class' : $root.getAspectClass($data,$index)} "></div>
<div class="live-tile">
<span class="tile-title" data-bind="text: title, css:{'big' : bigtitle}"></span>
<div>
<p>a</p>
</div>
</div>
</div>
</section>
</div>
我有上面的绑定。在某些情况下,我需要在内部 div 周围注入一个包装器。
<div>
<section>
<-- if $myFunction() inject <div> -->
<div>
<div></div> // THIS IN HERE SHOULD BE THERE ALWAYS:
<div > // THIS IN HERE SHOULD BE THERE ALWAYS:
</div> // THIS IN HERE SHOULD BE THERE ALWAYS:
</div>
<-- if $myFunction() inject </div> -->
</section>
</div>
我希望这是有道理的。