您好,登錄后才能下訂單哦!
這篇文章主要介紹java使用Thymeleaf時(shí)可能會(huì)使用的標(biāo)簽有哪些,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
1 . onclick事件
<a th:onclick="'javascript:more()'" ></a>
2.引入CSS樣式
<link th:href="@{fore/css/public.css}" rel="stylesheet">
3.引入js 文件
<script th:src="@{fore/js/index.js}" type="text/javascript"></script>
4. 引入頭部信息,和尾部信息
注:html(文件夾)/public.html 頁(yè)面上的 頭部和尾部信息引入
<!-- 導(dǎo)航 頭部信息--> <!-- 導(dǎo)航 頭部信息引入 --> <div class="nav-container" th:fragment="topper"> <div th:replace="html/public :: topper"> </div> <!-- 底部信息 --> <!-- 底部信息引入 --> <div class="att-bottom" th:fragment="footer"> <div th:replace="html/public :: footer"></div>
5. 圖片引入
<img th:src="@{fore/images/nav_icona.png}"/>
6.頁(yè)面遍歷
<li th:each="item,i:${list}"></li>
7.if 判斷 以及 th:text 取值
<span th:if="${item.types==1}" style="color:green;"> <span th:text=" ${item.coinNum}" ></span> <i class='fa fa-database'></i> </span>
8.時(shí)間類型格式化
<span th:text="${#dates.format(item.updateTime,'yyyy/MM/dd HH:mm')}"></span>
9.自定義標(biāo)簽屬性
<p th:attr="_tId=${item.taskId}">
10.獲取css樣式
<i class='fa fa-database'></i>
注:獲取 <i class='fa fa-database'></i> 圖標(biāo)樣式 時(shí),<i>標(biāo)簽不能寫在th:text <span>的取值中,另寫一個(gè)'<span>'標(biāo)簽 與取值的<span標(biāo)簽不屬于同一標(biāo)簽內(nèi)即可> (如下)
<span th:if="${item.types==1}" style="color:green;"> <span th:text=" ${item.coinNum}" ></span> <i class='fa fa-database'></i> </span>
這樣即可獲取 <i class='fa fa-database'></i> 圖標(biāo)樣式
以上是java使用Thymeleaf時(shí)可能會(huì)使用的標(biāo)簽有哪些的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。