資訊卡動作,可在主機應用程式中顯示連結預覽資訊卡和智慧型方塊。詳情請參閱「使用智慧型方塊預覽連結」。
const decoratedText = CardService.newDecoratedText().setTopLabel('Hello').setText('Hi!'); const cardSection = CardService.newCardSection().addWidget(decoratedText); const card = CardService.newCardBuilder().addSection(cardSection).build(); const linkPreview = CardService.newLinkPreview().setPreviewCard(card).setTitle( 'Smart chip title');
方法
| 方法 | 傳回類型 | 簡短說明 | 
|---|---|---|
| print | String | 列印此物件的 JSON 表示法。 | 
| set | Link | 設定預覽資訊卡上方連結預覽畫面中顯示的標題。 | 
| set | Link | 設定資訊卡,顯示第三方或非 Google 服務的連結相關資訊。 | 
| set | Link | 設定連結預覽畫面中智慧型方塊顯示的標題。 | 
內容詳盡的說明文件
print
列印此物件的 JSON 表示法。這項設定僅供偵錯。
回攻員
String
set
設定在預覽資訊卡上方連結預覽畫面中顯示的標題。如果未設定,連結預覽畫面會顯示 Preview 的標頭。
const linkPreview = CardService.newLinkPreview().setLinkPreviewTitle('Link preview title');
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| title | String | 連結預覽的標題。 | 
回攻員
Link:這個物件用於鏈結。
set
設定資訊卡,顯示第三方或非 Google 服務的連結相關資訊。
const decoratedText = CardService.newDecoratedText().setTopLabel('Hello').setText('Hi!'); const cardSection = CardService.newCardSection().addWidget(decoratedText); const card = CardService.newCardBuilder().addSection(cardSection).build(); const linkPreview = CardService.newLinkPreview().setPreviewCard(card).setTitle( 'Smart chip title');
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| preview | Card | 預覽資訊卡。 | 
回攻員
Link:這個物件用於鏈結。
set
設定連結預覽畫面中智慧型方塊顯示的標題。如果未設定,智慧型方塊會顯示 Preview 的標頭。
const linkPreview = CardService.newLinkPreview().setTitle('Smart chip title');
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| title | String | 智慧型方塊的標題。 | 
回攻員
Link:這個物件用於鏈結。