前言
- spring boot 2.1.1.RELEASE
- thymeleaf 3.0
静态属性
<sapn th:text="${T(java.lang.Math).PI}">PI</span>
效果:
静态方法
<sapn th:text="${T(java.lang.Math).random()}" >random</span>
效果:
获取当前时间
<input type="text" name="createTime"
th:value="${#calendars.format(T(java.util.Calendar).getInstance().getTime(),'yyyy-MM-dd')}" />
【ruoyi若依】 用户头像
<img th:with="avatar=${T(org.apache.shiro.SecurityUtils).getSubject().getPrincipal().avatar}"
th:src="@{${#strings.defaultString(avatar,'/images/user-head.jpg')}}"
class="user-info" />
【ruoyi若依】 用户名
<span th:text="${T(org.apache.shiro.SecurityUtils).getSubject().getPrincipal().userName}">用户名</span>