human thymeleaf在theach时不要保留本身的标签例如 div theach=book$randomByPrice 这个在生成时带上一个多余的div怎么去掉;
AI: 在th:each中,可以使用th:remove标签来移除当前标签,如下所示:
<th:block th:each="book:${randomByPrice}">
<div th:remove="tag">
<p th:text="${book.title}"></p>
<p th:text="${book.author}"></p>
</div>
</th:block>
这样就可以在生成时去除多余的div标签了。
原文地址: https://www.cveoy.top/t/topic/dFVR 著作权归作者所有。请勿转载和采集!