如何将 msg.payload 从函数节点发送到模板节点 [英] How to send msg.payload from function node to template node
本文介绍了如何将 msg.payload 从函数节点发送到模板节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将msg.payload
从功能节点(工具)发送到模板节点(html)?
How to send msg.payload
from function node(tool) to template node(html)?
<html>
<head>
<script type="text/javascript">
// function test() {
// document.getElementById("test1").innerHTML = msg.payload;
// }
</script>
</head>
<body onload="test()">
<h1 id="test1">{{msg.payload}}</h1>
</body>
推荐答案
问题是您在模板节点中使用了 {{msg.payload}}
.通过 mustache 拉入的值是从 msg
对象键入的.所以正确的胡子模板是{{payload}}
.
The problem is you are using {{msg.payload}}
in the template node. The values pulled in via mustache are keyed from the msg
object. So the correct mustache template is {{payload}}
.
<head>
<script type="text/javascript">
// function test() {
// document.getElementById("test1").innerHTML = {{payload}};
// }
</script>
</head>
<body onload="test()">
<h1 id="test1">{{payload}}</h1>
</body>
Node-RED 中的信息侧边栏提供了使用示例.
The Info sidebar in Node-RED gives examples of what to use.
这篇关于如何将 msg.payload 从函数节点发送到模板节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文