在art_template中如何进行多纬数据遍历展示? 也就是 多个 {{each}} 如何使用?
引入art-template
<script src="/assets/libs/art-template/dist/template.js"></script>
数据输入
<script>
var data = {
list:[
{name:'first','messages':[{title:'一条信息'},{title:'一条信息'},{title:'一条信息'}]},
{name:'second','messages':[{title:'一条信息'},{title:'一条信息'},{title:'一条信息'}]},
]
};
var html = template('demoTpl',data);
</script>
模板内容
<script type="text/html" id="demoTpl">
{{each list as value}}
<div class="report-item">
<div class="name">
{{value.name}}
</div>
{{each value.messages as msg}}
<div class="report-msg">
<div class="msg">{{msg.title}}</div>
</div>
{{/each}}
</div>
{{/each}}
</script>