模板布局
- th:include 加载指定文件内容(Thymeleaf 3.0 之后不再推荐使⽤ th:include.),例如
<div th:include="/common/select::server"></div>
加载common目录下select(.html, 因为项目里配了匹配后缀,这里不需要加)的 server 部分,server部分是啥嘞?
<div th:fragment="server1">是这个</div>
- th:fragment: 定义片段名字,让别的地方引用
另外:Thymeleaf 模板布局 th:fragment、th:replace、th:insert、th:remove, 很不错,大佬提供了很多例子
待更新……
本文介绍了Thymeleaf模板引擎中th:include和th:fragment的用法,重点讲解了如何通过th:fragment定义页面片段,并使用th:include引用这些片段进行页面组装。th:fragment允许在模板中定义可重用的部分,而th:include则用于在目标页面中插入这些片段,提高代码复用率。此外,还提及了th:replace、th:insert和th:remove等指令,它们在模板布局中起到关键作用。
1159

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



