1.遍历表达式
<ul id="carList" class="list-unstyled"> <script id="carListTmp" type="text/html"> {{each nodes}} <li> <input type="checkbox" value="{{#$value.val}}" name=""> {{$value.name}} </li> {{/each}} </script> </ul>
2.模板包含表达式
<ul id="carList" class="list-unstyled"> <script id="carListTmp" type="text/html"> <li> {{$value.name}} {{include ‘carListTmp2‘ $value.children}} </li> </script> </ul>
3.条件表达式
<script id="carListTmp3" type="text/html"> <ul> {{if $value.color === "red"}} <i class="fa fa-circle-o text-red"></i> {{else if $value.color === "green"}} <i class="fa fa-circle-o text-green"></i> {{else}} <i class="fa fa-circle-o text-default"></i> {{/if}} </ul> </script>
时间: 2024-11-03 17:25:26