Update 80-template.html

This commit is contained in:
xuyu0v0
2023-07-10 20:34:03 +08:00
committed by GitHub
parent f6e529ca1f
commit 848c27f534

View File

@@ -14,25 +14,25 @@
limitations under the License.
-->
<script type="text/x-red" data-help-name="template">
<script type="text/html" data-help-name="template">
<p>根据提供的模板设置属性</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>一个msg对象其中包含着用于填充模板的信息</dd>
<dt class="optional">template <span class="property-type">string</span></dt>
<dt class="optional">template <span class="property-type">字符串</span></dt>
<dd><code>msg.payload</code>msg</dd>
</dl>
<h3>Outputs</h3>
<h3>输出</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>由来自传入msg的属性来填充已配置的模板后输出的带有属性的msg</dd>
</dl>
<h3>详细</h3>
<p>默认情况下使用<i><a href="http://mustache.github.io/mustache.5.html" target="_blank">mustache</a></i>格式如有需要也可以切换其他格式</p>
<p>例如:
<p>例如当模板为:
<pre>Hello {{payload.name}}. Today is {{date}}</pre>
<p>receives a message containing:
<p>收到一条消息其中包含
<pre>{
date: "Monday",
payload: {
@@ -42,5 +42,11 @@
<p>输出的消息将会是:
<pre>Hello Fred. Today is Monday</pre>
<p>也可以使用流上下文或全局上下文中的属性<code>{{flow.name}}</code><code>{{global.name}}</code><code>store</code>使<code>{{flow[store].name}}</code><code>{{global[store].name}}</code>
<p><b>注意</b>默认情况下,<i>mustache</i>将在其替换的值中转义任何非字母数字或HTML实体为了防止这种情况请使用<code>{{{triple}}}</code>
<p><b>注意</b>默认情况下,<i>mustache</i>将在其替换的值中转义任何非字母数字或HTML实体为了防止这种情况请使用<code>{{{triple}}}</code></p>
<p>如果您需要在内容中使用<code>{{ }}</code>
例如要使用<code>[[ ]]</code></p>
<pre>{{=[[ ]]=}}</pre>
<h4>使用环境变量</h4>
<p>模板节点可以使用以下语法访问环境变量</p>
<pre>My favourite colour is {{env.COLOUR}}.</pre>
</script>