Class CardSection

CardSection

資訊卡區段可存放一組小工具,並以視覺化的方式區分小工具。

適用於 Google Workspace 外掛程式和 Google Chat 應用程式。

var image = CardService.newImage();
// Build image ...
var textParagraph = CardService.newTextParagraph();
// Build text paragraph ...

var cardSection = CardService.newCardSection()
    .setHeader("Section header")
    .addWidget(image)
    .addWidget(textParagraph);

方法

方法傳回類型簡短說明
addWidget(widget)CardSection將指定的小工具加入此部分。
setCollapsible(collapsible)CardSection設定是否可收合。
setHeader(header)CardSection設定版面的標題。
setNumUncollapsibleWidgets(numUncollapsibleWidgets)CardSection設定當此區段收合時,仍顯示的小工具數量。

內容詳盡的說明文件

addWidget(widget)

將指定的小工具加入此部分。小工具會按照加入順序顯示。每個資訊卡區段最多只能新增 100 個小工具。

參數

名稱類型說明
widgetWidget要新增至該部分的小工具。

回攻員

CardSection:這個物件用於鏈結。


setCollapsible(collapsible)

設定是否可收合。

參數

名稱類型說明
collapsibleBoolean可收合的設定。

回攻員

CardSection:這個物件用於鏈結。


setHeader(header)

設定版面的標題。選用。

參數

名稱類型說明
headerString標題文字。

回攻員

CardSection:這個物件用於鏈結。


setNumUncollapsibleWidgets(numUncollapsibleWidgets)

設定當此區段收合時,仍顯示的小工具數量。顯示的小工具一律是第一個新增的小工具。

參數

名稱類型說明
numUncollapsibleWidgetsInteger要顯示的小工具數量。

回攻員

CardSection:這個物件用於鏈結。