提问人:user5531485 提问时间:6/18/2023 最后编辑:Julianuser5531485 更新时间:6/19/2023 访问量:144
如何在节点 ui 模板的 <script> 中使用胡须表示法
How to use mustache notation within <script> in a nodered ui template
问:
我的 node-red UI 模板节点以这样的脚本开头:
<script>
(function($scope) {
稍后在脚本中有一个 if 语句,如下所示:
} else if ($scope.msg.topic === "temperature_avg") {
high = 88;
mid = 65;
low = 60;
size= "0.9em";
}
我不想在这个脚本中硬编码变量,而是想通过 msg.payload.ranges1 传递它们,并让 if 语句如下所示:
} else if ($scope.msg.topic === "temperature_avg") {
{{msg.payload.ranges1}}
}
但它不起作用。
答:
-1赞
user5531485
6/19/2023
#1
我将 ui 模板变成了一个子流,并为每个流复制了它,能够从单个子流位置编辑所有子流。
评论
high = 88; mid = 65; low = 60; size= "0.9em";