thymeleaf動態拼接class


場景:站內消息,一些已讀的要區別與未讀的。

      <table class="layui-table">
        <thead>
        <tr>
           
            <th lay-data="{field:'details', width:'70%',align: 'left'}">
                消息內容
            </th>
            <th lay-data="{field:'stata', width:'12%',align: 'center'}">
                時間
            </th>
            <th lay-data="{field:'money',width:'12%',align: 'center'}">
                消息類型
            </th>
        </tr>
        </thead>
        <tbody>

        <tr th:each="bean,stat:${list}" th:classappend="${(bean.readStatus=='status/read' ? 'read ' : '') + 'pageChange'}" th:attr="data-page=@{/notification/detail(id=${bean.id})}">                       
            <td class="S224_message_detail" th:text="${bean.title}"></td>
            <td th:text="${#temporals.format(bean.createTime, 'yyyy-MM-dd HH:mm:ss', locale)}"></td>
            <td th:text="${bean.typeLabel}"></td>
        </tr>
        </tbody>
    </table>

 

 

參考來源:

https://stackoverflow.com/questions/41480973/thymeleaf-classappend-for-multiple-classes


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM