【发布时间】:2019-09-09 07:26:24
【问题描述】:
我正在将 Spring Boot 1 应用程序迁移到 Spring Boot 2。 在原始应用程序中,我看到很多这样的片段:
<script th:inline="javascript">
<th:block th:include="fragments/script :: actionsMenu-js"/>
$(document).ready(function() {
...
});
现在使用 Thymeleaf 3,即使将包含更改为插入,这似乎也不再起作用:
<script th:inline="javascript">
<th:block th:insert="~{fragments/script :: actionsMenu-js}"/>
$(document).ready(function() {
...
});
没有插入块并且Javascript不正确,我得到:
messages:180 Uncaught SyntaxError: Unexpected token <
我可以去编辑所有页面并将块放在脚本之外,但我更喜欢需要较少重构的方法。
【问题讨论】:
标签: javascript thymeleaf