thymeleaf th:replace th:include th:insert 的区别
-
th:insert:保留自己的主标签,保留th:fragment的主标签。 -
th:replace:不要自己的主标签,保留th:fragment的主标签。 -
th:include:保留自己的主标签,不要th:fragment的主标签。(官方3.0后不推荐)
本文详细解析了 Thymeleaf 中 th:insert、th:replace 和 th:include 三个模板指令的区别及使用场景,并通过示例展示了它们在实际应用中的表现。
th:insert :保留自己的主标签,保留th:fragment的主标签。
th:replace :不要自己的主标签,保留th:fragment的主标签。
th:include :保留自己的主标签,不要th:fragment的主标签。(官方3.0后不推荐)
4476

被折叠的 条评论
为什么被折叠?