使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
blockly > dialog > setPrompt
dialog.setPrompt() 函数
设置在调用 Blockly.dialog.prompt() 时要运行的函数。
**重要提示**:替换此项时,请注意非原生提示体验可能需要在 FocusManager 中管理暂时性焦点。原生窗口提示不需要这样做,因为它会阻止在打开期间更改焦点。
Signature:
export declare function setPrompt(promptFunction?: (message: string, defaultValue: string, callback: (result: string | null) => void) => void): void;
参数
参数 |
类型 |
说明 |
promptFunction |
(message: string, defaultValue: string, callback: (result: string | null) => void) => void |
(可选)要运行的函数,或为 undefined 以恢复默认实现。 |
返回:
void
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-25。"],[],["The `dialog.setPrompt()` function sets a custom function to be executed when `Blockly.dialog.prompt()` is invoked. This function accepts a `promptFunction` as a parameter, which itself takes three arguments: two strings (`p1`, `p2`) and a callback function (`p3`). The callback function takes a string or null as input. The `setPrompt` function does not return any value. Its key action is to assign the passed custom function.\n"]]