Thymeleaf 教程

固定值布尔属性

HTML 有布尔属性的概念,这些属性没有值,出现一个就意味着该值为 "真"。在 XHTML 中,这些属性只取1个值,就是它本身。

例如,checked:

<input type="checkbox" name="option2" checked /> <!-- HTML -->
<input type="checkbox" name="option1" checked="checked" /> <!-- XHTML -->

标准方言包括允许您通过评估条件来设置这些属性的属性,因此,如果评估为True,则该属性将设置为其固定值,如果评估为False,则不会设置该属性:

<input type="checkbox" name="active" th:checked="${user.active}" />

标准方言中存在以下固定值布尔属性:

th:async                th:autofocus    th:autoplay
th:checked              th:controls     th:declare
th:default              th:defer        th:disabled
th:formnovalidate       th:hidden       th:ismap
th:loop                 th:multiple     th:novalidate
th:nowrap               th:open         th:pubdate
th:readonly             th:required     th:reversed
th:scoped               th:seamless     th:selected
说说我的看法
全部评论(
没有评论
关于
本网站属于个人的非赢利性网站,转载的文章遵循原作者的版权声明,如果原文没有版权声明,请来信告知:hxstrive@outlook.com
公众号