【发布时间】:2017-10-05 17:03:30
【问题描述】:
我的 html 文件中有一个表格,其填充如下:
<table>
<thead>
<tr>
<th class="text-left">First Name</th>
<th class="text-left">Last Name</th>
<th class="text-left">Status</th>
</tr>
</thead>
<tbody>
<tr th:each="user : ${users}">
<td class="text-left" th:text="${user.firstname}"></td>
<td class="text-left" th:text="${user.lastname}"></td>
<td class="text-left" th:text="${user.status}"></td>
</tr>
</tbody>
</table>
问题在于,对于状态,我有两个条件:在线和离线,我想做的是如果 status=='online' 将 th:text 颜色更改为绿色,并且当 status=='offline' 将其更改为红色的。我不知道是否有办法用百里香来做到这一点,或者我必须使用 javascript。
【问题讨论】:
标签: javascript html spring thymeleaf