场景:站内消息,一些已读的要区别与未读的。

<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>

thymeleaf动态拼接class_编程

 

 

参考:

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