当前位置: 代码迷 >> 综合 >> Thymeleaf中循环渲染List集合中的数字th:style用法
  详细解决方案

Thymeleaf中循环渲染List集合中的数字th:style用法

热度:69   发布时间:2024-02-28 06:34:24.0
  1. thymeleaf循环遍历数字

<ul th:each="user : ${userList}"><li><div th:each="star : ${#numbers.sequence(1,user.star)}"><img th:src="@{/img/star.png}"></div></li>
</ul>   

   2.thymeleaf中th:style的用法

<div style="margin-top: 10px"><span>经验:</span><div class="stat-percent" th:text="${user.zcExpe}+ '%'" ></div><div class="progress progress-mini" style="width: 55%;display: inline-block"><div th:style="'width:'+ ${user.zcExpe}+'%'" name="width" class="progress-bar">            </div></div>
</div>