我似乎找不到任何文档或论坛答案来使 HeroCard 中的图像可点击。我希望能够单击图像并执行与使用按钮相同的 imBack()
操作。
最佳答案
您可以使用 HeroCard
的 Tap
属性使英雄卡的图像转到该链接。
发布一些 C# 示例代码:
using System;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using System.Collections.Generic;
namespace Bot_Application2.Dialogs
{
[Serializable]
public class RootDialog : IDialog<object>
{
public async Task StartAsync(IDialogContext context)
{
context.Wait(ConversationStartedAsync);
}
public async Task ConversationStartedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument)
{
IMessageActivity reply = context.MakeMessage();
HeroCard heroCard = new HeroCard()
{
Title = "I'm a hero card",
Images = new List<CardImage>
{
new CardImage(url: $"https://www.google.org/assets/static/images/logo_googledotorg-171e7482e5523603fc0eed236dd772d8.svg")
},
Tap = new CardAction()
{
Value = $"https://www.google.co.in/",
Type = "openUrl",
}
};
reply.Attachments = new List<Attachment>
{
heroCard.ToAttachment()
};
await context.PostAsync(reply);
}
}
}
关于node.js - 可点击的 HeroCard 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45283764/