0
我有一个<div>
块,我需要根据条件设置为display:none
或display:block
。在HTML看起来像这样,如何根据百里香的条件将样式应用于div?
<div style="display:none;">
//some html block content
</div>
我试过在thymeleaf下面的代码,
<div th:style="${condition} == 'MATCH' ? display:block : display:none">
//some html block content
</div>
但上面的表达式是行不通的。抛出org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression:
错误消息。
我可以做th:classappend
来设置一些类,并做这项工作,但想知道如果猫王/三元运营商将支持在thymeleaf th:style
标签。