您不能在
一旦您能够使用 1.2,您就可以使用 Action.ToggleVisibility。这是一个示例卡片:
{
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Everything in the blue container will stay when the button is clicked.",
"wrap": true
}
],
"spacing": "ExtraLarge",
"separator": true,
"style": "accent"
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Everything in the green container will hide when the button is clicked",
"wrap": true
},
{
"type": "Image",
"altText": "",
"url": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png"
}
],
"spacing": "None",
"horizontalAlignment": "Center",
"style": "good",
"selectAction": {
"type": "Action.ToggleVisibility",
"targetElements": [
"hide"
]
},
"id": "hide"
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.ToggleVisibility",
"title": "Hide the Green Section",
"targetElements": [
"hide"
]
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
您可以将该 JSON 粘贴到 Designer 的“Card Payload Editor”中,然后单击“Preview Mode”进行尝试。
请注意,是否支持此功能取决于客户,而不仅仅是卡片架构。
由于您不能使用 1.2,因此可以选择:
- 使用提交操作创建卡片
- 单击“提交”操作后,让客户端将卡片替换为不包含您要隐藏的部分的卡片。
在 Bot Framework 中,您可以使用 UpdateActivity() 在支持它的频道上完成 #2(一般用户可以在其中编辑消息的任何频道)。
这并不理想,但它是你可以用