zoukankan      html  css  js  c++  java
  • thymeleaf使用之多变量

    <div>迭代状态对象</div>
    <table>
        <tr th:each="data,iterState : ${#numbers.sequence(0,2)}"
            th:style="|background-color:| + ${iterState.odd ? 'while' : 'gray'}">
            <td th:text="|从0开头的索引:| + ${iterState.index}"></td>
            <td th:text="|从1开头的索引:| + ${iterState.count}"></td>
            <td th:text="|数据集合大小:| + ${iterState.size}"></td>
            <td th:text="|当前节点:| + ${iterState.current}"></td>
            <td th:text="|是否第一次迭代:| + ${iterState.first}"></td>
            <td th:text="|是否最后一次迭代:| + ${iterState.last}"></td>
            <td th:text="|是否偶数迭代:| + ${iterState.even}"></td>
            <td th:text="|是否奇数迭代:| + ${iterState.odd}"></td>
        </tr>
    </table>
    

     要将文本和变量进行组合,使用如:

    托尔斯泰+'${user}'

    还有链接的变量拼接

              <dl class="layui-nav-child" th:each="reci,reciStat : ${recis}">
                  <dd><a th:href="@{'/ar/'+${reciStat.index}}"  th:text="${reci.keyword}+'('+${reci.number}+')'" target="frame"></a></dd>
              </dl>
    
  • 相关阅读:
    js数组和数组去重的几种简单的方法
    nodejs项目的model操作mongo
    canvas画布
    bson
    神奇的东西
    sql与nosql
    mong大牛的blog
    mongo 增删改查
    Mongo配置基础
    session放数据库里解决丢失的问题
  • 原文地址:https://www.cnblogs.com/zhukaile/p/15616615.html
Copyright © 2011-2022 走看看