thymeleaf th:include th:replace

最近在捣鼓thymeleaf,遇见了问题。

thymeleaf做页面布局。

thymeleaf  th:include   th:replace

如何动态的更换th:include的文件呢 ,比如说我点击不同的导航菜单,content更换显示内容。

我用JS试着改变th:include 发现不起作用, 有米有大佬支个招

回答

您好,js中如何使用呢?

Thymel17076a对应的尺寸eaf 视图是在后端渲染的,因此前端改变th:include属性的值是没有效果的。想要达到动态变换的效果必须在后端就修改th:include的属性值。

给你一个提示:

<div th:432开头的身份证是哪里的includ="${page}17072a是什么尺码::${fragment}"></div>

在后端修改page和fragment的值就可以达到动态效果。