node.js - 如何在微软bot框架中以表格格式显示数据

标签 node.js botframework adaptive-cards

谁能帮我把BOT中的数据表格式显示如下

enter image description here

最佳答案

您可以利用 ColumeSetadaptive card呈现类似卡片消息的表格。

例如,下面的json内容会被渲染成一个类似卡片信息的表格:

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.0",
    "body": [
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "TextBlock",
                            "weight": "bolder",
                            "text": "Name"
                        },
                        {
                            "type": "TextBlock",
                            "separator":true,
                            "text": "Apple"
                        },{
                            "type": "TextBlock",
                            "separator":true,
                            "text": "Kiwi"
                        }
                    ]
                },
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "TextBlock",
                            "weight": "bolder",
                            "text": "Tag"
                        },
                        {
                            "type": "TextBlock",
                            "separator":true,
                            "text": "Fruit"
                        },{
                            "type": "TextBlock",
                            "separator":true,
                            "text": "Fruit"
                        }
                    ]
                },
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "TextBlock",
                            "weight": "bolder",
                            "text": "Price"
                        },
                        {
                            "type": "TextBlock",
                            "separator":true,
                            "text": "2"
                        },{
                            "type": "TextBlock",
                            "separator":true,
                            "text": "1"
                        }
                    ]
                }
            ]
        }
    ]
}

在 WebChat channel 中,它看起来像:

enter image description here

关于node.js - 如何在微软bot框架中以表格格式显示数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48149833/

相关文章:

node.js - 微软bot框架网络聊天直连隐藏 secret ——NODE JS

c# - 如何知道Bot框架中Action.OpenUrl被点击的url?

objective-c - 在 swift 中创建依赖于另一个 objective-c pod 的 pod

azure - 解决缺乏对 Adaptive Cards 1.2 支持的问题

node.js - 当我没有 webpack.config.js 文件时在哪里添加disableHostCheck

azure - 使用 ARM 完全自动化 Microsoft bot 框架部署(应用程序设置被删除且功能缺失)

node.js - Express网关给出404

c# - IBotToUser 实现停止事件日志记录

Javascript 数组匹配复杂度较低

javascript - 在新机器上启动 Ember 项目时出错 : Unexpected token import, define is not defined