首页 > 其他 > 详细

thymeleaf使用日记

时间:2019-11-20 21:04:20      阅读:90      评论:0      收藏:0      [点我收藏+]

引入mavin

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

yml配置

thymeleaf:
    cache: false # 方便前端可以及时拿到更新数据
    check-template-location: true
    prefix: classpath:/templates/
    suffix: .html
    encoding: utf-8
    mode: HTML5

如果通过拦截器访问thymeleaf丢失样式、脚本

 <link rel="icon" href="../assets/img/favicon.ico" th:href="@{~../assets/img/favicon.ico}">
<link rel="stylesheet" type="text/css" href="css/webbase.css" th:href="@{~/css/webbase.css}" />
<link rel="stylesheet" type="text/css" href="css/pages-login-manage.css" th:href="@{~/css/pages-login-manage.css}" />

使用th:href在路径前面加一个~即可解决

thymeleaf使用日记

原文:https://www.cnblogs.com/easyLog/p/11899809.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!