Node-RED中Button按钮组件和TextInput文字输入组件的使用

发布时间:2022-06-23 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了Node-RED中Button按钮组件和TextInput文字输入组件的使用脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

场景

Node-RED简介与Windows上安装、启动和运行示例:

https://blog.csdn wangt.cc /BADAO_LIUMANG_QIZHI/article/details/121884766

Node-RED怎样导出导入流程为json文件:

https://blog.csdn wangt.cc /BADAO_LIUMANG_QIZHI/article/details/124130985

Node-RED安装图形化节点dashboard实现订阅mqtt主题并在仪表盘中显示温度:

https://blog.csdn wangt.cc /BADAO_LIUMANG_QIZHI/article/details/121992760

在上面的基础上怎样使用Button按钮组件和TextInput文字输入组件。

注:

博客: https://blog.csdn wangt.cc /badao_liumang_qizhi 关注公众号 霸道的程序猿获取编程相关电子书、教程推送与免费下载。

实现

1、拖拽编辑Button组件,使其点击时输出1

Node-RED中Button按钮组件和TextInput文字输入组件的使用

 

 

2、拖拽TextInput组件并编辑

Node-RED中Button按钮组件和TextInput文字输入组件的使用

 

 

3、Json数据

[
    {
        "id": "f4a4d8eab7935bc8",
        "type": "tab",
        "label": "流程 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "b704c867.534e98",
        "type": "ui_button",
        "z": "f4a4d8eab7935bc8",
        "name": "",
        "group": "248cbbb0.18e794",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "开启",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "1",
        "payloadType": "num",
        "topic": "topic",
        "topicType": "msg",
        "x": 290,
        "y": 140,
        "wires": [
            [
                "bfd300fc.9119b"
            ]
        ]
    },
    {
        "id": "bfd300fc.9119b",
        "type": "debug",
        "z": "f4a4d8eab7935bc8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 480,
        "y": 140,
        "wires": []
    },
    {
        "id": "3d808cbd.363e64",
        "type": "ui_text_input",
        "z": "f4a4d8eab7935bc8",
        "name": "",
        "label": "输入姓名:",
        "tooltip": "",
        "group": "248cbbb0.18e794",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": 300,
        "topic": "topic",
        "sendOnBlur": true,
        "className": "",
        "topicType": "msg",
        "x": 300,
        "y": 240,
        "wires": [
            [
                "9b262bb1.709268"
            ]
        ]
    },
    {
        "id": "9b262bb1.709268",
        "type": "debug",
        "z": "f4a4d8eab7935bc8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 500,
        "y": 240,
        "wires": []
    },
    {
        "id": "248cbbb0.18e794",
        "type": "ui_group",
        "name": "MyGroup",
        "tab": "3f79c420.cfc1bc",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "3f79c420.cfc1bc",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

 

4、访问ui页面

http://127.0.0.1:1880/ui

点击Button,并在输入框输入文字

Node-RED中Button按钮组件和TextInput文字输入组件的使用

 

 

查看输出控制台

Node-RED中Button按钮组件和TextInput文字输入组件的使用

 

 

 

Node-RED中Button按钮组件和TextInput文字输入组件的使用

脚本宝典总结

以上是脚本宝典为你收集整理的Node-RED中Button按钮组件和TextInput文字输入组件的使用全部内容,希望文章能够帮你解决Node-RED中Button按钮组件和TextInput文字输入组件的使用所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: