关于thymeleaf 迭代 数组

先贴我的代码

<tr th:each=" title : ${titles}">
            <th th:text="${title}"></th>
        </tr>

titles 是一个数组。。

效果图如下

clipboard.png

生成的 html 代码

<tr>
                <th>订单</th>
            </tr>
            <tr>
                <th>店名</th>
            </tr>
            <tr>
                <th>电话</th>
            </tr>
            <tr>
                <th>地址</th>
            </tr>

但是我要的效果是想要 一个 tr 中包含 4个 th

<tr>
    <th>订单</th>
     <th>店名</th>
    <th>电话</th>
     <th>地址</th>
</tr>

请问如何做到。。。。

阅读 8.8k
1 个回答

clipboard.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进