Class Carousel

輪轉介面

輪播 (又稱滑桿) 會以投影片形式輪流顯示小工具清單,並提供按鈕,方便使用者前往上一個或下一個小工具。

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

const carousel =
    CardService.newCarousel()
        .addCarouselCard(CardService.newCarouselCard().addWidget(
            CardService.newTextParagraph().setText('The first text paragraph in carousel')))
        .addCarouselCard(CardService.newCarouselCard().addWidget(
            CardService.newTextParagraph().setText('The second text paragraph in carousel')))
        .addCarouselCard(CardService.newCarouselCard().addWidget(
            CardService.newTextParagraph().setText('The third text paragraph in carousel')))

方法

方法傳回類型簡短說明
addCarouselCard(card)Carousel新增輪轉介面卡片。
addEventAction(eventAction)Widget新增可在小工具上執行的事件動作。
setId(id)Widget設定指派的專屬 ID,用於識別要變動的小工具。
setVisibility(visibility)Widget設定小工具的顯示設定。

內容詳盡的說明文件

addCarouselCard(card)

新增輪轉介面卡片。

const carousel =
    CardService.newCarousel()
        .addCarouselCard(CardService.newCarouselCard().addWidget(
            CardService.newTextParagraph().setText('The first text paragraph in carousel')));

參數

名稱類型說明
cardCarouselCard要新增的輪轉介面卡片。

回攻員

Carousel - 這個物件,用於鏈結。


addEventAction(eventAction)

新增可在小工具上執行的事件動作。

參數

名稱類型說明
eventActionEventAction要新增的 EventAction

回攻員

Widget - 鏈結用的物件。


setId(id)

設定指派的專屬 ID,用於識別要變動的小工具。外掛程式僅支援小工具突變。

參數

名稱類型說明
idString小工具的 ID,最多 64 個字元,格式為 `[a-zA-Z0-9-]+`。

回攻員

Widget - 這個物件,用於鏈結。


setVisibility(visibility)

設定小工具的顯示設定。預設值為 `VISIBLE`。

參數

名稱類型說明
visibilityVisibility小工具的 Visibility

回攻員

Widget - 鏈結用的物件。