简体   繁体   English

如何在Node-Red中显示网页上的有效负载

[英]How to display payload on a webpage in Node-Red

I currently have a setup where a websocket is pulling in a msg.payload that consists of a number. 我目前有一个安装程序,其中Websocket正在拉入一个由数字组成的msg.payload。 it goes into the template node. 它进入模板节点。

The template node says "This is the payload {{payload}} !" 模板节点说“这是有效载荷{{payload}}!”

I'm expecting to see the number on the page but when i go to the page, it just shows me "This is the payload: [object Object] !" 我期望在页面上看到该数字,但是当我转到该页面时,它只会显示“这是有效载荷:[object Object]!”。

Any idea what I could be doing wrong? 知道我做错了什么吗?

That suggests that msg.payload is not a simple number as you think, but is actually a JavaScript Object of some sort. 这表明msg.payload并非您想象的那样简单,而是实际上是某种JavaScript对象。

If you pass the message to a Debug node you can confirm exactly what it contains in the Debug sidebar. 如果将消息传递给Debug节点,则可以确切确认消息包含在Debug边栏中。 You can then identify the proper way to access its contents and update the Template accordingly. 然后,您可以确定访问其内容的适当方法并相应地更新模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM