thymeleaf if elseif 多条件判断

如果要实现if else if else 判断表达式,在thymeleaf要使用th:switch代替,th:case="*"表示默认,需写在最后

<div class="top" th:switch="${area}">
        <div class="logo" th:case="'a'">
            <img th:src="@{/static/images/logo-A.png}">
        </div>
        <div class="logo" th:case="'b'">
            <img th:src="@{/static/images/logo-B.png}">
        </div>
        <div class="logo" th:case="*">
            <img th:src="@{/static/images/logo-c.png}">
        </div>
    </div>

 


版权声明:本文为itdragons原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。