节点红色仪表板。 Ui 模板,使用 msg.payload 更新 url
Node-Red Dashboard. Ui template, update the url using msg.payload
我需要在 node-red 的仪表板中更改 ui_template 的 url。
如果我这样写:
<iframe src="https://online.wonderware.eu/s/l5kctp/Explore/Analysis/loquesea/Embed"></iframe>
我可以看到:
如果我尝试使用 msg.payload 发送 url,您会看到:
我尝试使用下一个代码获取有效载荷:
<iframe src={{msg.payload}}></iframe>
有效载荷是:
msg.payload="https://online.wonderware.eu/s/l5kctp/Explore/Analysis/loquesea/Embed";
我尝试了很多 sintaxis 来读取有效载荷,但我无法正确读取它。
你知道如何读取负载并更改 ui_template url 吗?
谢谢
您需要在模板中引用一些引号:
<iframe src="{{msg.payload}}"></iframe>
应该可以。
以下流程作为演示:
[{"id":"73ac3c27.dcfd64","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"28b66011.fbc02","type":"ui_tab","z":"","name":"Home","icon":"dashboard"},{"id":"99b10eed.f26b","type":"ui_group","z":"","name":"Default","tab":"28b66011.fbc02","disp":true,"width":"6"},{"id":"54e8a488.88e8bc","type":"inject","z":"73ac3c27.dcfd64","name":"","topic":"","payload":"http://localhost:1880","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":200,"y":220,"wires":[["2823261f.a736ea"]]},{"id":"2823261f.a736ea","type":"ui_template","z":"73ac3c27.dcfd64","group":"99b10eed.f26b","name":"","order":0,"width":0,"height":0,"format":"\n<iframe src=\"{{msg.payload}}\"></iframe>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":420,"y":240,"wires":[[]]}]
尝试使用 ui_template 前面的模板节点。您想使用三个大括号来转义 HTML.
<iframe src={{{payload}}}></iframe>
[{"id":"8fbf7029.588de","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"dc2dd6a.d014628","type":"inject","z":"8fbf7029.588de","name":"","topic":"","payload":"http://localhost:1880","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"0.5","x":230,"y":220,"wires":[["35a71b83.0fda04"]]},{"id":"c1cf74f3.655238","type":"ui_template","z":"8fbf7029.588de","group":"d2702cb6.ab449","name":"","order":0,"width":"22","height":"12","format":"","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":600,"y":220,"wires":[[]]},{"id":"35a71b83.0fda04","type":"template","z":"8fbf7029.588de","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src={{{payload}}}></iframe>","output":"str","x":420,"y":220,"wires":[["c1cf74f3.655238"]]},{"id":"d2702cb6.ab449","type":"ui_group","z":"","name":"G1","tab":"223c13e7.70f2cc","disp":true,"width":"22","collapse":false},{"id":"223c13e7.70f2cc","type":"ui_tab","z":"","name":"T1","icon":"dashboard","disabled":false,"hidden":false}]
我需要在 node-red 的仪表板中更改 ui_template 的 url。 如果我这样写:
<iframe src="https://online.wonderware.eu/s/l5kctp/Explore/Analysis/loquesea/Embed"></iframe>
我可以看到:
如果我尝试使用 msg.payload 发送 url,您会看到:
我尝试使用下一个代码获取有效载荷:
<iframe src={{msg.payload}}></iframe>
有效载荷是:
msg.payload="https://online.wonderware.eu/s/l5kctp/Explore/Analysis/loquesea/Embed";
我尝试了很多 sintaxis 来读取有效载荷,但我无法正确读取它。
你知道如何读取负载并更改 ui_template url 吗?
谢谢
您需要在模板中引用一些引号:
<iframe src="{{msg.payload}}"></iframe>
应该可以。
以下流程作为演示:
[{"id":"73ac3c27.dcfd64","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"28b66011.fbc02","type":"ui_tab","z":"","name":"Home","icon":"dashboard"},{"id":"99b10eed.f26b","type":"ui_group","z":"","name":"Default","tab":"28b66011.fbc02","disp":true,"width":"6"},{"id":"54e8a488.88e8bc","type":"inject","z":"73ac3c27.dcfd64","name":"","topic":"","payload":"http://localhost:1880","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":200,"y":220,"wires":[["2823261f.a736ea"]]},{"id":"2823261f.a736ea","type":"ui_template","z":"73ac3c27.dcfd64","group":"99b10eed.f26b","name":"","order":0,"width":0,"height":0,"format":"\n<iframe src=\"{{msg.payload}}\"></iframe>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":420,"y":240,"wires":[[]]}]
尝试使用 ui_template 前面的模板节点。您想使用三个大括号来转义 HTML.
<iframe src={{{payload}}}></iframe>
[{"id":"8fbf7029.588de","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"dc2dd6a.d014628","type":"inject","z":"8fbf7029.588de","name":"","topic":"","payload":"http://localhost:1880","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"0.5","x":230,"y":220,"wires":[["35a71b83.0fda04"]]},{"id":"c1cf74f3.655238","type":"ui_template","z":"8fbf7029.588de","group":"d2702cb6.ab449","name":"","order":0,"width":"22","height":"12","format":"","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":600,"y":220,"wires":[[]]},{"id":"35a71b83.0fda04","type":"template","z":"8fbf7029.588de","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src={{{payload}}}></iframe>","output":"str","x":420,"y":220,"wires":[["c1cf74f3.655238"]]},{"id":"d2702cb6.ab449","type":"ui_group","z":"","name":"G1","tab":"223c13e7.70f2cc","disp":true,"width":"22","collapse":false},{"id":"223c13e7.70f2cc","type":"ui_tab","z":"","name":"T1","icon":"dashboard","disabled":false,"hidden":false}]