thymeleaf三元运算符

三元条件运算

标准版本:
三元运算符:(if) ? (then) : (else)spa

<p th:text="${user.online ? '在线' : '离线'}"> </p>
<p th:text="${user.online ? (user.vip ? 'VIP用户在线' : '普通用户在线') : '离线'}"> </p>
 
变态版本:

 <input type="radio" name="machineState" th:value="${dict.dictValue}" th:checked="${machine.machineState == null} ? ${dict.ok}:(${machine.machineState} == ${dict.dictValue})">code

相关文章
相关标签/搜索