依赖
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-tymeleaf
// 可以查看依赖关系,发现spring-boot-starter-thymeleaf下面已经包括了spring-boot-startr-web,所以可以把spring-boot-starter-web的依赖去掉.
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf',version: rootProject.ext.springBootVersion
传递数据到JS
1、js的 <script type="text/javascript"> 替换成 <script th:inline="javascript">
2、js中定义变量 var name =[[${userid}]]
3、动态加载js <script th:src="@{'js/pay/'+${pid}+'.js'}" />