【发布时间】:2020-11-10 03:30:14
【问题描述】:
在我的 Spring Boot 项目中,我正在迭代一个 Thymeleaf 列表,如下所示:
<div th:each="filename: ${files}">
<div class="bold badge badge-primary" th:text="${filename}"></div>
</div>
问题:我不知道如何在遍历它们时将徽章主要和徽章次要 (bootstrap4.5) 类分配给备用列表项?
简单来说,第一个列表项应该有 badge-primary 类,第二个列表项应该有 badge-secondary 类。
有可能吗?如果是,那么如何?谢谢。
【问题讨论】:
标签: spring spring-boot bootstrap-4 thymeleaf