thymeleaf傳值onclick到js


帶有單引號

targetUrl('val')

<a th:onclick="'javascript:targetUrl(\''+${indexURL.value}+'\');'">

 

不帶有單引號:

targetUrl(val)

<a th:onclick="'javascript:targetUrl('+${indexURL.value}+');'">

 

 

 

thymeleaf傳值onclick到js

<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 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>

 

 


</div>

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM