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

 

使用Thymeleaf如何动态定义背景图,如下代码(需要注意单引号!!!):

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

我这里${tmh[0].pic}是一个图片的url

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM