blockly > FieldTextInput > (建構函式)

FieldTextInput.(constructor)

建構 FieldTextInput 類別的新執行個體

Signature:

constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldTextInputValidator | null, config?: FieldTextInputConfig);

參數

參數 類型 說明
string | Field.SKIP_SETUP 的類型 (選用) 欄位的初始值。應轉換為字串。如果為空值或未定義,就會預設為空白字串。如果您想略過設定,也請使用 Field.SKIP_SETUP (只在自己的建構函式執行後,用於處理設定及設定欄位值的子類別使用)。
validator FieldTextInputValidator | 空值 (選用) 系統會呼叫這個函式,用於驗證欄位值的變更。擷取字串並傳回已驗證字串,或是傳回 null 以取消變更。
config FieldTextInputConfig (選用) 用來設定欄位的選項對應。如需這個參數支援的屬性清單,請參閱 [欄位建立說明文件]:https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/text-input#creation