包含一组以行显示、换行到下一行以实现水平滚动的 Chip 对象。
适用于 Google Chat 应用。在 Google Workspace 加购项的开发者预览版中。
const chip = CardService.newChip(); // Finish building the text chip... const chipList = CardService.newChipList() .setLayout(CardService.ChipListLayout.WRAPPED) .addChip(chip);
方法
| 方法 | 返回类型 | 简介 |
|---|---|---|
add | Chip | 添加条状标签。 |
add | Widget | 添加可在 widget 上执行的事件操作。 |
set | Widget | 设置用于标识要发生变异的 widget 的唯一 ID。 |
set | Chip | 设置 chip 列表布局。 |
set | Widget | 设置 widget 的可见性。 |
详细文档
add Event Action(eventAction)
set Id(id)
设置用于标识要发生变异的 widget 的唯一 ID。只有在插件中支持 widget 突变。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
id | String | 微件的 ID,长度限制为 64 个字符,格式为 `[a-zA-Z0-9-]+`。 |
返回
Widget - 此对象,用于链式调用。
set Layout(layout)
设置 chip 列表布局。如果未设置,则默认为 Chip 布局。
const chip = CardService.newChip(); // Finish building the text chip... const chipList = CardService.newChipList() .setLayout(CardService.ChipListLayout.HORIZONTAL_SCROLLABLE) .addChip(chip);
参数
| 名称 | 类型 | 说明 |
|---|---|---|
layout | Chip | 条状标签列表布局。 |
返回
Chip - 此对象,用于链式调用。