如Google网站上所述,您可以在基本卡上添加边框。
我通过下面的代码构建了基本卡,并且可以正常工作
conversation.ask(new BasicCard({
text: cardText,
subtitle: product.company_name,
title: product.name,
buttons: new Button({
title: 'View Details',
url: deeplink_url,
}),
image: new Image({
url: product.image,
alt: 'Image alternate text',
}),
}));
Google网站上的操作说,您可以通过调用.setImageDisplay方法添加边框,该方法接受字符串作为其参数。
在上面的代码片段中我应该在哪里调用此方法?
答案 0 :(得分:1)
您链接到的文档适用于客户端库的原始版本。在我的第1版动作中,我有类似以下内容的行
card = app.buildBasicCard()
.setImage(<image_goes_here>, <alternate>, <width>, <height>)
.setImageDisplay('CROPPED');
在版本2动作中,我有类似的内容
card.image = {};
card.image.url = <image_goes_here>;
card.image.width = <width>;
card.image.height = <height>;
card.image.accessibilityText = <alternate_text>;
card.display = 'CROPPED';
...
card = new BasicCard(card);