导入插件,调用就不说了,可以翻我以前发的文章;
语法:
{{each list value index}}
{{value.字段名}}
{{/each}}
index 是索引,下标;
value 是值。
具体演示:
<script id="course_list" type="text/html">
{{each list value index}}
<div class="content">
<div class="content_left">
<img src="{{value.cover_image}}" alt="">
</div>
<div class="content_right">
<h3>{{value.course_name}}</h3>
<div class="price">
{{if value.price == 0}}
<div class="price_total" style="visibility: hidden;">
{{else if value.price != 0}}
<div class="price_total">
{{/if}}
<span class="price_one">¥{{value.price}}.00</span>
<span class="price_two">¥{{value.original_price}}.00</span>
</div>
{{if value.status == 1}}
<div class="button">立即预约</div>
{{else if value.status == 2}}
<div class="button">立即报名</div>
{{/if}}
</div>
</div>
</div>
{{/each}}
</script>