# @data
变量
¥@data
variables
以下 @data
变量由 Handlebars 及其内置助手实现。
¥The following @data
variables are implemented by Handlebars and its builtin helpers.
# @root
执行模板所使用的初始上下文。
¥Initial context with which the template was executed.
除非显式修改,否则该值在页面渲染的所有部分中都是一致的,这意味着它可以在深度参数无法引用其父模板的部分中使用。
¥Unless explicitly modified, this value is consistent across all portions of the page rendering, meaning it can be used within partials where depthed parameters are unable to reference their parent templates.
# @first
对于迭代的第一步,由 each
辅助程序设置为 true。
¥Set to true by the each
helper for the first step of iteration.
# @index
当前迭代步骤的从零开始的索引。由 each
助手设置。
¥Zero-based index for the current iteration step. Set by the each
helper.
# @key
当前迭代步骤的键名。迭代对象时由 each
助手设置。
¥Key name for the current iteration step. Set by the each
helper when iterating over objects.
# @last
对于迭代的最后一步,由 each
助手设置为 true。
¥Set to true by the each
helper for the last step of iteration.
# @level
指定的日志级别。
¥Assigned log level.
template({}, { data: { level: Handlebars.logger.WARN } });
可以设置为 Handlebars.logger.DEBUG
、 Handlebars.logger.INFO
、 Handlebars.logger.WARN
或 Handlebars.logger.ERROR
之一
¥May be set to one of Handlebars.logger.DEBUG
, Handlebars.logger.INFO
, Handlebars.logger.WARN
, or
Handlebars.logger.ERROR
设置后,日志器将仅在其输出中包含日志级别为 Handlebars.logger.level
或更高的消息。默认值为 Handlebars.logger.ERROR
。
¥When set, the logger will include in its output only messages with a log level of Handlebars.logger.level
or higher.
The default value is Handlebars.logger.ERROR
.