首页 > 解决方案 > 节点红色 - 模板节点不自动加载网站小部件

问题描述

我在我创建的节点红色仪表板中有一个带有以下代码的模板节点(忽略#):

<a class="weatherwidget-io" href="https://forecast7.com/en/n37d81144d96/melbourne/" data-#font="Verdana" data-icons="Climacons Animated" data-theme="original" data-basecolor="#282828" #data-accent="#282828" data-highcolor="#ffffff" data-lowcolor="#ffffff" data-cloudfill="#282828" data-#raincolor="#0871b8" data-snowcolor="#ffffff" >Melbourne VIC, Australia

当我第一次加载节点红色仪表板时它可以工作,但是当我单击其他选项卡然后单击回到这个选项卡时,小部件无法正确加载。我可以让它再次加载的唯一方法是关闭并重新打开仪表板。

谁能建议我如何确保它保持加载?

我试过这些流程:

[
{
    "id": "ab355109a22e1cb3",
    "type": "tab",
    "label": "Flow 2",
    "disabled": false,
    "info": ""
},
{
    "id": "0c321c8a39c4bb46",
    "type": "inject",
    "z": "ab355109a22e1cb3",
    "name": "trigger auto check",
    "props": [
        {
            "p": "payload"
        }
    ],
    "repeat": "60",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "topic": "",
    "payloadType": "date",
    "x": 850,
    "y": 480,
    "wires": [
        [
            "1afcdeb10cb56d5f"
        ]
    ]
},
{
    "id": "1afcdeb10cb56d5f",
    "type": "ui_template",
    "z": "ab355109a22e1cb3",
    "group": "680a90e74f2439dd",
    "name": "Weather",
    "order": 4,
    "width": "20",
    "height": "3",
    "format": "<a class=\"weatherwidget-io\" href=\"https://forecast7.com/en/n37d81144d96/melbourne/\" data-font=\"Verdana\" data-icons=\"Climacons Animated\" data-theme=\"original\" data-basecolor=\"#282828\" data-accent=\"#282828\" data-highcolor=\"#ffffff\" data-lowcolor=\"#ffffff\" data-cloudfill=\"#282828\" data-raincolor=\"#0871b8\" data-snowcolor=\"#ffffff\" >Melbourne VIC, Australia</a>\n<script>\n!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='https://weatherwidget.io/js/widget.min.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weatherwidget-io-js');\n</script>",
    "storeOutMessages": true,
    "fwdInMessages": false,
    "resendOnRefresh": true,
    "templateScope": "local",
    "x": 840,
    "y": 180,
    "wires": [
        [
            "182193f823e35dfd"
        ]
    ]
},
{
    "id": "182193f823e35dfd",
    "type": "debug",
    "z": "ab355109a22e1cb3",
    "name": "",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "false",
    "statusVal": "",
    "statusType": "auto",
    "x": 1030,
    "y": 260,
    "wires": []
},
{
    "id": "680a90e74f2439dd",
    "type": "ui_group",
    "name": "Main",
    "tab": "e6d742089da75a60",
    "order": 1,
    "disp": false,
    "width": "20",
    "collapse": false
},
{
    "id": "e6d742089da75a60",
    "type": "ui_tab",
    "name": "Main",
    "icon": "dashboard",
    "order": 1,
    "disabled": false,
    "hidden": false
}
]

[
{
    "id": "377ae3af691e5c69",
    "type": "ui_template",
    "z": "4d9b60f02c48e798",
    "group": "680a90e74f2439dd",
    "name": "Weather",
    "order": 4,
    "width": "20",
    "height": "3",
    "format": "{{payload}};",
    "storeOutMessages": true,
    "fwdInMessages": false,
    "resendOnRefresh": true,
    "templateScope": "local",
    "x": 920,
    "y": 360,
    "wires": [
        []
    ]
},
{
    "id": "6d2bcc99931e2495",
    "type": "ui_ui_control",
    "z": "4d9b60f02c48e798",
    "name": "Reload weather",
    "events": "all",
    "x": 520,
    "y": 340,
    "wires": [
        [
            "290b8b542bfe791f"
        ]
    ]
},
{
    "id": "290b8b542bfe791f",
    "type": "template",
    "z": "4d9b60f02c48e798",
    "name": "",
    "field": "payload",
    "fieldType": "msg",
    "format": "handlebars",
    "syntax": "mustache",
    "template": "<a class=\"weatherwidget-io\" href=\"https://forecast7.com/en/n37d81144d96/melbourne/\" data-font=\"Verdana\" data-icons=\"Climacons Animated\" data-theme=\"original\" data-basecolor=\"#282828\" data-accent=\"#282828\" data-highcolor=\"#ffffff\" data-lowcolor=\"#ffffff\" data-cloudfill=\"#282828\" data-raincolor=\"#0871b8\" data-snowcolor=\"#ffffff\" >Melbourne VIC, Australia</a>\n<script>\n!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='https://weatherwidget.io/js/widget.min.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weatherwidget-io-js');\n</script>",
    "output": "str",
    "x": 750,
    "y": 360,
    "wires": [
        [
            "377ae3af691e5c69"
        ]
    ]
},
{
    "id": "680a90e74f2439dd",
    "type": "ui_group",
    "name": "Main",
    "tab": "e6d742089da75a60",
    "order": 1,
    "disp": false,
    "width": "20",
    "collapse": false
},
{
    "id": "e6d742089da75a60",
    "type": "ui_tab",
    "name": "Main",
    "icon": "dashboard",
    "order": 1,
    "disabled": false,
    "hidden": false
}
]

标签: htmlnode-red

解决方案


推荐阅读