简体   繁体   English

是否可以在自适应卡的主体数组内添加action.open url?

[英]is it possible to add action.open url inside the body array in adaptive card?

In my bot application i need to display a action.open Url button in-between the text.I need to Add Action.Open url inside the body tag of the json at the end of date as shown in the image and need to click the url link to do some actions. 在我的机器人应用程序中,我需要在文本之间显示一个action.open Url按钮。我需要在日期末尾在json的body标签内添加Action.Open url,如图所示,然后单击url链接执行一些操作。

Adaptive Card Design Image 自适应卡设计图像

is it possible to add the button in-between text or at the top of text inside the body tag.? 是否可以在body标签内的文本之间或文本顶部添加按钮?

 { "type": "AdaptiveCard", "body": [ { "type": "TextBlock", "size": "Medium", "weight": "Bolder", "color": "Warning", "text": "Company Name" }, { "type": "TextBlock", "text": "Meeting Details", "wrap": true }, { "type": "FactSet", "facts": [ { "title": "Description", "value": "xxx" }, { "title": "Key Note Speaker", "value": "yyy" }, { "title": "Date :", "value": "03/25/2019 12:30:00 PM" } ] }, { "type": "TextBlock", "horizontalAlignment": "Center", "size": "ExtraLarge", "weight": "Bolder", "color": "Accent", "text": "**************" }, { "type": "TextBlock", "text": "Meeting Details", "wrap": true }, { "type": "FactSet", "facts": [ { "title": "Description", "value": "xxx" }, { "title": "Key Note Speaker", "value": "yyy" }, { "title": "Date :", "value": "03/25/2019 12:30:00 PM" } ] }, { "type": "TextBlock", "horizontalAlignment": "Center", "size": "ExtraLarge", "weight": "Bolder", "color": "Accent", "text": "**************" } ], "actions": [ { "type": "Action.OpenUrl", "title": "Add to Calender", "url": "http://adaptivecards.io" }, { "type": "Action.OpenUrl", "title": " Click here to add more Info ", "url": "http://adaptivecards.io" } ], "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.0" } 

Unfortunately, the default location for buttons in AdaptiveCards is at the bottom of the card, and you are unable to change that. 不幸的是,AdaptiveCards中按钮的默认位置在卡的底部,您无法更改它。 However, you can add an image styled how ever you'd like to the card with a selectAction attribute that will submit data associated with the action when the user clicks the image. 但是,您可以使用selectAction属性向卡添加样式为您想要的图像,该属性将在用户单击图像时提交与操作关联的数据。 For more details see the example AdaptiveCard JSON below and the AdaptiveCard Documentation for Images and Select Actions . 有关更多详细信息,请参见下面的示例AdaptiveCard JSON以及有关图像选择操作的AdaptiveCard文档。

Screenshot 截图

在此处输入图片说明

JSON JSON

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Large",
            "weight": "Bolder",
            "color": "Accent",
            "text": "Company Name"
        },
        {
            "type": "TextBlock",
            "separator": true,
            "size": "Medium",
            "text": "Meeting Details"
        },
        {
            "type": "TextBlock",
            "text": "Description:"
        },
        {
            "type": "TextBlock",
            "text": "Keynote Speaker:"
        },
        {
            "type": "TextBlock",
            "text": "Date:"
        },
        {
            "type": "Image",
            "selectAction": {
                "type": "Action.Submit",
                "data": "Meeting 1"
            },
            "url": "C:\\Users\\v-thdurn\\Developer\\Node\\Azure\\thdurn-all-channels-src\\resources\\button.png"
        },
        {
            "type": "TextBlock",
            "separator": true,
            "size": "Medium",
            "text": "Meeting Details"
        },
        {
            "type": "TextBlock",
            "text": "Description:"
        },
        {
            "type": "TextBlock",
            "text": "Keynote Speaker:"
        },
        {
            "type": "TextBlock",
            "text": "Date:"
        },
        {
            "type": "Image",
            "selectAction": {
                "type": "Action.Submit",
                "data": "Meeting 2"
            },
            "url": "C:\\Users\\v-thdurn\\Developer\\Node\\Azure\\thdurn-all-channels-src\\resources\\button.png"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.0"
}

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM