在宿主应用中显示链接预览卡片和智能条状标签的卡片操作。如需了解详情,请参阅包含智能条状标签的预览链接。
const decoratedText = CardService.newDecoratedText().setTopLabel('Hello').setText('Hi!'); const cardSection = CardService.newCardSection().addWidget(decoratedText); const card = CardService.newCardBuilder().addSection(cardSection).build(); const linkPreview = AddOnsResponseService.newLinkPreview().setPreviewCard(card).setTitle( 'Smart chip title');
方法
| 方法 | 返回类型 | 简介 |
|---|---|---|
print | String | 输出此对象的 JSON 表示形式。 |
set | Link | 设置链接预览中显示在预览卡片上方的标题。 |
set | Link | 设置用于显示来自第三方服务或非 Google 服务的链接相关信息的卡片。 |
set | Link | 设置链接预览的智能条状标签中显示的标题。 |
详细文档
print Json()
输出此对象的 JSON 表示形式。此属性仅用于调试。
返回
String
set Link Preview Title(title)
设置链接预览中显示在预览卡片上方的标题。如果未设置,链接预览会显示 Preview 的标题。
const linkPreview = AddOnsResponseService.newLinkPreview().setLinkPreviewTitle( 'Link preview title', );
参数
| 名称 | 类型 | 说明 |
|---|---|---|
title | String | 链接预览的标题。 |
返回
Link - 此对象,用于链式调用。
set Preview Card(previewCard)
设置用于显示来自第三方服务或非 Google 服务的链接相关信息的卡片。
const decoratedText = CardService.newDecoratedText().setTopLabel('Hello').setText('Hi!'); const cardSection = CardService.newCardSection().addWidget(decoratedText); const card = CardService.newCardBuilder().addSection(cardSection).build(); const linkPreview = AddOnsResponseService.newLinkPreview().setPreviewCard(card).setTitle( 'Smart chip title');
参数
| 名称 | 类型 | 说明 |
|---|---|---|
preview | Card | 预览卡片。 |
返回
Link - 此对象,用于链式调用。
set Title(title)
设置链接预览的智能条状标签中显示的标题。如果未设置,智能芯片会显示 Preview 的标题。
const linkPreview = AddOnsResponseService.newLinkPreview().setTitle('Smart chip title');
参数
| 名称 | 类型 | 说明 |
|---|---|---|
title | String | 智能条状标签的标题。 |
返回
Link - 此对象,用于链式调用。