代码之家  ›  专栏  ›  技术社区  ›  hkhan

自适应卡中的自适应卡用于常见问题解答

  •  0
  • hkhan  · 技术社区  · 5 年前

    我正在考虑创建一个用于常见问题解答的自适应卡。所以有一个带有动作的卡。带有标题常见问题解答的展示卡。一旦用户点击FAQ,卡片就会展开显示5个问题。一个问题本身就是一个自适应卡,因此当用户单击一个问题时,卡打开以显示答案。

    我不能在一张卡片里放一张卡片。这是我用的JSON Adaptive Card designer

    {
        "type": "AdaptiveCard",
        "body": [
            {
                "type": "TextBlock",
                "size": "Medium",
                "weight": "Bolder",
                "text": "Hi I am a ChatBot."
            },
            {
                "type": "TextBlock",
                "text": "Look at FAQs below.",
                "wrap": true
            }
        ],
        "actions": [
            {
                "type": "Action.ShowCard",
                "title": "FAQs",
                "card": {
                    "type": "AdaptiveCard",
                    "style": "emphasis",
                    "body": [
                        {
                            "type": "TextBlock",
                            "text": "How quickly can we close?"
                        }
                    ],
                    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
                }
            },
            {
                "type": "Action.ShowCard",
                "title": "Comment",
                "card": {
                    "type": "AdaptiveCard",
                    "style": "emphasis",
                    "body": [
                        {
                            "type": "Input.Text",
                            "id": "comment",
                            "placeholder": "Enter your comment",
                            "isMultiline": true
                        }
                    ],
                    "actions": [
                        {
                            "type": "Action.Submit",
                            "title": "OK"
                        }
                    ],
                    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
                }
            }
        ],
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.0"
    }
    

    当我将action.showcard放入action.showcard标记中时,它会给出一个错误并将action.showcard更改为adpaticard。有人能给我看看这种设计的结构吗?这将很有帮助,因为我需要扩展这些常见问题解答。

    0 回复  |  直到 5 年前
        1
  •  1
  •   Kyle Delaney    5 年前

    也许我不理解你的问题,但我能够在设计师中创建你想要的结构,没有问题:

    {
        "type": "AdaptiveCard",
        "body": [
            {
                "type": "TextBlock",
                "size": "Medium",
                "weight": "Bolder",
                "text": "Hi I am a ChatBot."
            },
            {
                "type": "TextBlock",
                "text": "Look at FAQs below.",
                "wrap": true
            }
        ],
        "actions": [
            {
                "type": "Action.ShowCard",
                "title": "FAQs",
                "card": {
                    "type": "AdaptiveCard",
                    "style": "emphasis",
                    "actions": [
                        {
                            "type": "Action.ShowCard",
                            "title": "How quickly can we close?",
                            "card": {
                                "type": "AdaptiveCard",
                                "style": "emphasis",
                                "body": [
                                    {
                                        "type": "TextBlock",
                                        "text": "Never"
                                    }
                                ],
                                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
                            }
                        },
                        {
                            "type": "Action.ShowCard",
                            "title": "Second question",
                            "card": {
                                "type": "AdaptiveCard",
                                "style": "emphasis",
                                "body": [
                                    {
                                        "type": "TextBlock",
                                        "text": "Second answer"
                                    }
                                ],
                                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
                            }
                        }
                    ],
                    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
                }
            },
            {
                "type": "Action.ShowCard",
                "title": "Comment",
                "card": {
                    "type": "AdaptiveCard",
                    "style": "emphasis",
                    "body": [
                        {
                            "type": "Input.Text",
                            "id": "comment",
                            "placeholder": "Enter your comment",
                            "isMultiline": true
                        }
                    ],
                    "actions": [
                        {
                            "type": "Action.Submit",
                            "title": "OK"
                        }
                    ],
                    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
                }
            }
        ],
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.0"
    }