th:with 和 th:if 的区别

学习者

th:with 和 th:if 在百里香叶中有什么区别?我使用 th:if 还是 th:with?我不太确定他们的区别。

我试图搜索 th:with 的用法,但周围没有太多文档。

例如,

<td>    
    <div th:with="${a given condition}">    <!--do I use th:if or th:with here?-->
        <span th:if="${}"></span>
        <span th:if="${}"></span>
    </div>
</td>
银河战士

th:with用于分配变量它与评估条件无关,而是用于为变量赋值。sytnax 看起来像这样:

<div th:with="firstPer=${persons[0]}">

th:ifth:unless用于评估条件(以确定是否显示一个 html 块)。

<div th:if="${user.isAdmin()} == false">

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章