对调查结果进行统计的页面,在div的style中拼接后台参数,显示百分比
<tr th:each="option:*{obj.list}">
<td th:text="*{option.title}">选项</td>
<td th:text="*{option.poll}">小计</td>
<td th:inline="text">
<div style="float:left;width:160px; height:15px;
margin:3px 10px 0 10px;border-style:solid;border-width:1px;">
<div th:style="'background:#5f8dd4;height:15px;width:'+*{option.rate}+''">
</div>
</div>
<span>[[*{option.rate}]]</span>
</td>
</tr>
显示效果

本文介绍了一种在网页上展示调查结果统计的方法,通过在div的style中拼接后台参数,实现了以进度条形式显示各选项百分比的功能。具体实现包括使用th:each遍历选项,设置div的宽度为百分比,直观呈现投票结果。
767

被折叠的 条评论
为什么被折叠?



