【发布时间】:2021-09-21 15:31:55
【问题描述】:
我有一张自适应卡,代码如下。我面临的问题是单击Action.ShowCard 按钮后将显示的卡片无法渲染图像。它说undefined。当我在普通卡中使用它时,会显示相同的图像。我认为它无法渲染按钮卡片中的图像。要测试它,您可以复制App Studio's UI Tool 中的代码并单击Send me this card
我得到的截图
主要代码
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
],
"actions":[
{
"type": "Action.ShowCard",
"title": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"msteams": {
"entities": []
},
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/1200px-Image_created_with_a_mobile_phone.png",
"size": "Small"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Color theorysdjkf",
"wrap": true,
"weight": "Bolder",
"color": "Attention"
}
],
"verticalContentAlignment": "Center"
}
],
"height": "stretch",
"horizontalAlignment": "Center",
"separator": true,
"spacing": "Large"
},
{
"type": "TextBlock",
"wrap": true,
"spacing": "Small",
"text": "You selected **A**"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"wrap": true,
"text": "This is a long explanation for the answer and I think it is getting so long and long and long long long long "
}
]
}
],
"style": "emphasis",
"spacing": "Small"
}
]
},
"style": "positive"
}
]
}
【问题讨论】:
-
您是否将 wikimedia 添加到您应用的域白名单中?据我所知,MS Teams 仅允许从您在应用定义中列入白名单的任何内容加载图像。图片必须来自列入白名单的域。
-
如果这是问题所在,那么为什么它会显示在主卡中。我的意思是,如果我在它显示的主卡中使用相同的图像。但是如果我在 ShwCard 按钮的卡片中使用它,它就不会显示。我仍然会检查是否将其列入白名单
-
否 @TimCadenbach 我已添加域但没有运气
-
hmm 很奇怪......它在 AdaptiveCardStudio、Designer 甚至 Outlook 中都能正常工作......有点迷失在这里我只知道如果你检查图像,MS Teams 正在后台“做某事” url 你会看到它通过一些 MS 服务器路由。通常这是经过身份验证的资源后面的图像的问题,但这里不是这种情况
-
没错。这太有线了
标签: microsoft-teams adaptive-cards