blockly > 變數 > promptName

Variables.promptName() 函式

提示使用者輸入新的變數名稱。

Signature:

export declare function promptName(promptText: string, defaultText: string, callback: (p1: string | null) => void): void;

參數

參數 類型 說明
promptText 字串 提示的字串。
defaultText 字串 提示欄位中顯示的預設值。
回呼 (p1: string | null) => void 回呼。系統會傳遞新的變數名稱;如果使用者選取非法變數,則會回傳空值。

傳回:

void