封鎖 >封鎖 >setDisabledReason
Block.setDisabledReason() 方法
新增或移除封鎖原因如果封鎖條件有任何停用原因,系統會將其封鎖。封鎖條件可能同時存在多種原因,例如使用者手動停用或封鎖無效。
Signature:
setDisabledReason(disabled: boolean, reason: string): void;
參數
參數 |
類型 |
說明 |
已停用 |
布林值 |
如果設為 true,則至少應根據指定的原因封鎖封鎖,否則封鎖已失效。 |
原因 |
字串 |
用來說明封鎖原因的中立 ID。使用相同的 ID 再次呼叫這個方法,以更新該區塊目前是否基於此原因而停用。 |
傳回:
void
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-22 (世界標準時間)。
[null,null,["上次更新時間:2024-08-22 (世界標準時間)。"],[[["The `setDisabledReason()` method manages the reasons a block is disabled, affecting the block's overall disabled state."],["It takes a boolean (`disabled`) to indicate if the block should be disabled for the given reason, and a string (`reason`) to identify the specific reason."],["Calling `setDisabledReason()` with the same reason multiple times updates the block's disabled state for that reason."],["Blocks can be disabled for multiple reasons concurrently, accumulating reasons until all are removed for the block to be enabled."]]],["The `Block.setDisabledReason()` method manages reasons for a block's disabled state. It takes a boolean `disabled` and a string `reason`. If `disabled` is true, the block is considered disabled for the given `reason`; otherwise, it's no longer disabled for that reason. Multiple reasons can simultaneously disable a block, and the `reason` parameter acts as a unique identifier for each condition. The method updates the block's disabled status for each reason and returns nothing.\n"]]