[英]Thymeleaf: Add to existing values instead of replacing them
Is there a way to tell Thymeleaf
to add parameters to a tag instead of overriding them? 有没有办法告诉Thymeleaf
将参数添加到标签而不是覆盖它们?
Example: 例:
<div class="a" th:class=${x ? 'b' : 'c'}>
Should result in either 应该导致
<div class="a b">
or 要么
<div class="a c">
Regards 问候
另一种方法是
th:attr="class=|a ${x ? 'b' : 'c'}|"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.