thymeleaf傳值onclick到js

我的筆記javascript

<div th:onclick="'javascript:themPage(\''+${theme.value}+'\',\''+${theme.type}+'\');'"></div>
 
<script type="text/javascript">
<![CDATA[
function themPage(value,type){
console.log(value+"--"+type);
}
]]>
</script>
 
thymeleaf截取:日期格式爲:2017-09-10 11:22:12截取後的格式爲:2017-09-10
<div class="weui-cells__tips clearfix" th:with="hdrq=${order.hdrq}">使用日期:<span th:text="${#strings.substring(hdrq,0,10)}"></span></div>
 
我的筆記:

<div class="weui-loadmore">
  <div th:if="${list.count gt '4'}">
    <i class="weui-loading"></i>
    <span class="weui-loadmore__tips">正在加載</span>
  </div>
  <div th:if="${list.count lt '4'}">
    <span class="weui-loadmore__tips">沒有數據了</span>
    </div>
</div>java

 

使用Thymeleaf如何動態定義背景圖,以下代碼(須要注意單引號!!!):ui

<div class="placeholder thm_left" th:with="tmh=${tmhInfo}"  th:style="'background:url(' + ${tmh[0].pic} + ') no-repeat center center / cover;'" >
</div>url

我這裏${tmh[0].pic}是一個圖片的urlspa

相關文章
相關標籤/搜索