每次找都要从项目里找,为了方便丢出来方便查阅
<script id="childMenusTemp" type="text/html">
{{each list oneMenus i}}
<li class="">
{{ if oneMenus.cMenus.length == 0 }}
<a href="{{ oneMenus.resUrl }}" level="1"><i class="left-icon fa-folder"></i><span class="title">{{ oneMenus.menuName }}</span><span class="rightarrow"></span></a>
{{/if}}
{{ if oneMenus.cMenus.length > 0 }}
<a href="javascript:;" level="1"><i class="left-icon fa-folder"></i><span class="title">{{ oneMenus.menuName }}</span><span class="rightarrow"></span></a>
<ul class="sub-menu">
{{each oneMenus.cMenus twoMenus}}
<li>
{{ if twoMenus.cMenus.length == 0 }}
<a href="{{twoMenus.resUrl}}" url="{{twoMenus.resUrl}}" menuid="{{twoMenus.menuId}}" level="2"><i></i>{{twoMenus.menuName}}</a>
{{/if}}
{{ if twoMenus.cMenus.length > 0 }}
<a href="javascript:;" url="{{twoMenus.resUrl}}" menuid="{{twoMenus.menuId}}" level="2"><i></i>{{twoMenus.menuName}}</a>
{{each twoMenus.cMenus threeMenus}}
{{ if threeMenus.cMenus.length == 0 }}
<a href="{{threeMenus.resUrl}}" url="{{threeMenus.resUrl}}" menuid="{{threeMenus.menuId}}" level="2"><i></i>{{threeMenus.menuName}}</a>
{{/if}}
{{ if threeMenus.cMenus.length > 0 }}
<a href="javascript:;" url="{{threeMenus.resUrl}}" menuid="{{threeMenus.menuId}}" level="2"><i></i>{{threeMenus.menuName}}</a>
{{each threeMenus.cMenus fourMenus}}
<a href="javascript:;" url="{{fourMenus.resUrl}}" menuid="{{fourMenus.menuId}}" level="2"><i></i>{{fourMenus.menuName}}</a>
{{/each}}
{{/if}}
{{/each}}
{{/if}}
</li>
{{/each}}
</ul>
{{/if}}
</li>
{{/each}}
</script>
调用的时候
var html = template("specItemTemp", {
list : items
});