透過集合功能整理內容
你可以依據偏好儲存及分類內容。
封鎖 >封鎖 >getIcon
Block.getIcon() 方法
Signature:
getIcon<T extends IIcon>(type: IconType<T> | string): T | undefined;
參數
參數 |
類型 |
說明 |
類型 |
IconType<T>|字串 |
要擷取的圖示類型。使用 typescript 時,最好傳遞 IconType ,以便進行適當的類型檢查。 |
傳回:
T |未定義
如果指定類型的圖示位於區塊中,則會設為未定義。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],["The `Block.getIcon()` method retrieves an icon associated with a block. It accepts a parameter `type`, which specifies the icon type, preferably as an `IconType` for TypeScript type checking, or as a string. The method returns the icon of the specified type if it exists on the block, otherwise, it returns undefined. This allows users to access a specific icon from a Block by providing its corresponding type.\n"],null,[]]