Thymeleaf条件添加标签

时间:2019-02-03 05:24:29

标签: servlets bootstrap-4 thymeleaf

我的request属性(“ items”)中有一个项目列表,该列表将通过引导程序4(https://getbootstrap.com/docs/4.2/components/card/#card-decks)卡组每行3个项目呈现。我可以通过使用JSTL来做到这一点 .textarea:focus box-shadow: 0px 0px 73px 5px primary-color

ngOnInit() { this.selectedDish = this.dishData[0] ; }

现在,如何使用Thymeleaf达到相同的效果?谢谢

1 个答案:

答案 0 :(得分:0)

您的代码会将Thymeleaf转换为以下代码。

<th:block th:each="item, stat: ${items}">
    <th:block th:if="${stat.index eq 0}">
        <th:block th:if="${stat.index &gt; 0}">
            </div>
        </th:block>
        <div class="card-deck mt-3"> <!--Create new deck-->
    </th:block>
    <div class="card bg-light">
         <h5 class="card-header" th:text="${item.id}"></h5>
         <div class="card-body"></div>
     </div>  
</th:block>
相关问题