水平分隔线。如需向插件卡片添加分隔线,请在 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 | 添加可在 widget 上执行的事件操作。 |
set | Widget | 设置用于标识要发生变异的 widget 的唯一 ID。 |
set | Widget | 设置 widget 的可见性。 |
详细文档
add Event Action(eventAction)
set Id(id)
设置用于标识要发生变异的 widget 的唯一 ID。只有在插件中支持 widget 突变。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
id | String | 微件的 ID,长度限制为 64 个字符,格式为 `[a-zA-Z0-9-]+`。 |
返回
Widget - 此对象,用于链式调用。