[Springboot整合thymeleaf]处理js中的路径问题。

阅读 18

2023-10-30


使用了thymeleaf模板引擎之后,html中的标签,都可以直接替换成th:src th:href 但是处理js的中的资源路径并不是像jsp那么简单了。可以通过以下方式解决。


<!--处理路径问题-->
<script th:inline="javascript">
    var path = [[${#request.contextPath}]]
</script>
<script th:inline="none">

 

精彩评论(0)

0 0 举报