使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
blockly >屏蔽 >setDisabledReason
Block.setDisabledReason() 方法
添加或移除屏蔽的可能原因。如果某个屏蔽设置出于任何原因被停用,则该屏蔽本身会被视为已停用。屏蔽规则可能同时由于多个独立的原因而被停用,例如当用户手动停用屏蔽规则或屏蔽设置无效时。
Signature:
setDisabledReason(disabled: boolean, reason: string): void;
参数
参数 |
类型 |
说明 |
已停用 |
布尔值 |
如果为 true,则至少应出于所提供的原因将屏蔽操作视为已停用,否则屏蔽操作将不再由于该原因而被停用。 |
reason |
字符串 |
与语言无关的标识符,用于说明屏蔽功能可能被停用的原因。使用相同的标识符再次调用此方法,以更新相应屏蔽设置目前是否由于此原因而被停用。 |
返回:
void
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],["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"],null,[]]