JS代码
$('table tbody').html('');
for (var i=0;i<data2.length;i++)
{
var row = $("#template").clone();
row.find("#timeStr").text(data2[i].timeStr);
row.find("#count").text(data2[i].count);
row.find("#countRate").text(data2[i].countRate);
row.appendTo("#statisticsOpenAppCount_table");
}
HTML代码:
<table class="layui-table" lay-filter="statisticsOpenAppCount_table" id="statisticsOpenAppCount_table">
<thead>
<tr id="template">
<th lay-data="width:80" id="timeStr">时间</th>
<th lay-data="width:80, sort:true" id="count">启动次数</th>
<th lay-data="width:100" id="countRate">启动次数占比</th>
</tr>
</thead>
</table>