如何在ThumbnailsCard中使用“点击”

问题描述

我正在尝试使用MS bot框架在ThumbnailCard(TC)中使用点击选项。

看着documentation,我发现TC具有以下属性

标题,副标题,文本,按钮,图像并点击。

github上,我看不到tap属性,我想知道是否应该支持它,以及如何使用它。

const thumbnailCard = CardFactory.thumbnailCard(
        'BotFramework Thumbnail Card',[{ url: 'https://sec.ch9.ms/ch9/7ff5/e07cfef0-aa3b-40bb-9baa-7c9ef8ff7ff5/buildreactionbotframework_960.jpg' }],[{
            type: 'openUrl',title: 'Get started',value: 'https://docs.microsoft.com/en-us/azure/bot-service/'
        }],{
            subtitle: 'Your bots — wherever your users are talking.',text: 'Build and connect intelligent bots to interact with your users naturally wherever they are,from text/sms to Skype,Slack,Office 365 mail and other popular services.'
        }
    );

解决方法

您已经链接到文档,您可以在其中看到tap是卡片操作。您可以自己单击该缩略图卡片文档中的链接以查看card action documentation,还可以在buttons属性中看到卡片动作的示例。您可以使用该信息尝试类似的操作:

const thumbnailCard = CardFactory.thumbnailCard(
    'BotFramework Thumbnail Card',[{ url: 'https://sec.ch9.ms/ch9/7ff5/e07cfef0-aa3b-40bb-9baa-7c9ef8ff7ff5/buildreactionbotframework_960.jpg' }],[],{
        subtitle: 'Your bots — wherever your users are talking.',text: 'Build and connect intelligent bots to interact with your users naturally wherever they are,from text/sms to Skype,Slack,Office 365 mail and other popular services.',tap: {
            type: 'openUrl',title: 'Get started',value: 'https://docs.microsoft.com/en-us/azure/bot-service/'
        }
    }
);

由于卡片是用户界面元素,因此请记住,所有卡片行为都是特定于渠道的,并且不应期望tap在所有渠道上都能正常工作。如card support doc所述,您应该始终在要定位的每个渠道上测试卡,以查看有效的方法。

这些类别是故意的,由于卡,功能和渠道的许多可能组合,因此没有完全说明每个通道如何支持每个卡功能。请使用此表作为基本参考,但请在所需的通道中测试每张卡。