1:纯数字渲染列表
用到的方法i: ${#numbers.sequence(1,type.number)} // 此处设置取值范围
<option th:each="i:${#numbers.sequence(1,type.number)}" th:text="${i}"</option>
<div class="huxin" style="display:flex;flex-flow: row;justify-content: flex-start;">
<div th:each="type:${types}">
<select name="">
<option value="">0</option>
<option th:each="i:${#numbers.sequence(1,type.number)}" th:text="${i}"</option>
</select>
<span style="font-size: 12px;" th:text="${type.name}"></span>
</div>
</div>
2:方法带参数(亲测无误)
需注意参数需要用[[]]
th:onchange="javascript:huxin([[${type.name}]])"
<div class="huxin" style="display:flex;flex-flow: row;justify-content: flex-start;">
<div th:each="type:${types}">
<select name="" th:onchange="javascript:huxin([[${type.name}]])">
<option value="">0</option>
<option th:each="i:${#numbers.sequence(1,type.number)}" th:text="${i}"</option>
</select>
<span style="font-size: 12px;" th:text="${type.name}"></span>
</div>
</div>
3:常用标签
此处引用:https://blog.csdn.net/malimingwq/article/details/79329921
4:公共head/html/.. 封装
封装:
<footer th:fragment="footer" id="footer-main" class="footer-main container-fluid no-padding">
<!-- Top Footer -->
// 公共部分HTML
</footer><!-- Footer Main /- -->
引用:
在页面直接引用
<!-- Footer Main -->
<footer th:replace="footer::footer"></footer>
5:导入外部HTML报错
需要引入thymeleaf标签
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<!--引入thymeleaf标签-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html class="" lang="en"><!--<![endif]-->