9 th:* 属性优先级
我们可以在一个html标签中设置一个或多个th:*属性,有时为了避免冲突,thymeleaf为其设置了属性优先级机制。
优先级由高到低依次为:
Order | Feature | Attributes |
---|---|---|
1 | Fragment inclusion | th:include th:replace |
2 | Fragment iteration | th:each |
3 | Conditional evaluation | th:if th:unless th:switch th:case |
4 | Local variable definition | th:object th:with |
5 | General attribute modification | th:attr th:attrprepend th:attrappend |
6 | Specific attribute modification | th:value , th:href , th:src , etc. |
7 | Text (tag body modification) | th:text th:utext |
8 | Fragment specification | th:fragment |
9 | Fragment removal | th:remove |