百日咳的有条件算子

时间:2018-05-21 05:35:00

标签: html thymeleaf

如何在百里香中做这样的条件算子?

Ex: condiction ? result1 : result2

1 个答案:

答案 0 :(得分:1)

Looks like it's just...

<tr th:class="${row.even}? 'even' : 'odd'">
  ...
</tr>
<tr th:class="${row.even}? (${row.first}? 'first' : 'even') : 'odd'">
  ...
</tr>
<tr th:class="${row.even}? 'alt'">
  ...
</tr>