แบบสำรวจการวิจัย: บอกให้เราทราบเกี่ยวกับประสบการณ์การใช้งาน Blockly
เริ่มแบบสำรวจ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
blockly > dialog > setPrompt
ฟังก์ชัน dialog.setPrompt()
ตั้งค่าฟังก์ชันที่จะเรียกใช้เมื่อมีการเรียกใช้ Blockly.dialog.prompt()
**สำคัญ**: เมื่อลบล้างค่านี้ โปรดทราบว่าประสบการณ์พรอมต์ที่ไม่ใช่แบบเนทีฟอาจต้องจัดการโฟกัสชั่วคราวใน FocusManager ซึ่งไม่จำเป็นสำหรับพรอมต์หน้าต่างแบบเนทีฟเนื่องจากจะป้องกันไม่ให้โฟกัสเปลี่ยนขณะเปิดอยู่
ลายเซ็น:
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 |
(ไม่บังคับ) ฟังก์ชันที่จะเรียกใช้ หรือไม่ระบุเพื่อกู้คืนการใช้งานเริ่มต้น |
การคืนสินค้า:
โมฆะ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[[["เข้าใจง่าย","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"]],["อัปเดตล่าสุด 2025-07-25 UTC"],[[["Blockly's `dialog.setPrompt()` function assigns a custom function to be executed when the `Blockly.dialog.prompt()` is called, enabling developers to define the behavior of prompt dialogs."],["The assigned `promptFunction` receives three arguments: a title string, a message string, and a callback function to handle the user's input."]]],["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"]]