水平分隔線。如要在外掛程式卡片中新增分隔線,請在 Card 中使用 new 方法。舉例來說,下列範例會建構簡單的資訊卡,其中包含以分隔線分隔的 2 個段落。
function buildCard() { const cardSection1TextParagraph1 = CardService.newTextParagraph().setText('Hello world!'); const cardSection1Divider1 = CardService.newDivider(); const cardSection1TextParagraph2 = CardService.newTextParagraph().setText('Hello world!'); const cardSection1 = CardService.newCardSection() .addWidget(cardSection1TextParagraph1) .addWidget(cardSection1Divider1) .addWidget(cardSection1TextParagraph2); const card = CardService.newCardBuilder().addSection(cardSection1).build(); return card; }
方法
| 方法 | 傳回類型 | 簡短說明 |
|---|---|---|
add | Widget | 新增可在小工具上執行的事件動作。 |
set | Widget | 設定指派的專屬 ID,用於識別要變動的小工具。 |
set | Widget | 設定小工具的顯示設定。 |
內容詳盡的說明文件
add Event Action(eventAction)
set Id(id)
設定指派的專屬 ID,用於識別要變動的小工具。外掛程式僅支援小工具突變。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
id | String | 小工具的 ID,長度上限為 64 個字元,格式為 `[a-zA-Z0-9-]+`。 |
回攻員
Widget - 這個物件,用於鏈結。