thymeleaf模板引入static目录下的css文件和js文件,使用
<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>登录页</title>
<link rel="stylesheet" type="text/css" href="/css/layui.css"/>
</head>
<body></body>
<script type="text/javascript" src="/js/layui.js"></script>
</html>
而不是
<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>登录页</title>
<link rel="stylesheet" type="text/css" href="../static/css/layui.css"/>
</head>
<body></body>
<script type="text/javascript" src="../static/js/layui.js"></script>
</html>
此外,登录时网页Console报错
Refused to apply style from 'http://localhost:8080/js/css/modules/laydate/default/laydate.css?v=5.3.0' because its MIME type ('application/json') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
在layui.js文件里搜索css
修改
为