嗨,我试图两次运行for循环
<script id="row-property" type="text/x-jsrender">
{{for }}
<div class="row mt-2">
<div class="col-2">
Cell {{:count}}
</div>
<div class="col-2">
<select id="cell_{{:count}}_size">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</div>
</div>
{{/for}}
<div class="row mt-2">
<div class="col-2">
<input id="row-apply" template="row-template" template-controls="{{for }} cell_{{:count}}_size, {{/for}}" clear-before-execute="true" template-output-selector=".focused.row" value="Apply" type="button" />
</div>
</div>
</script>
但是我得到的只是
<div class="row mt-2">
<div class="col-2">
<input id="row-apply" template="row-template" template-controls=" cell_3_size, " clear-before-execute="true" template-output-selector=".focused.row" value="Apply" type="button" />
</div>
</div>
在第二个循环中
请帮助
答案 0 :(得分:0)
当我渲染模板时,我需要向我“不迭代地渲染”,这意味着我要输入带有数组的模板,就像输入带有每个对象的模板并评估它一样。
var html = songsTemplate.render(list, true);