blockly > FieldVariable > getValidator
FieldVariable.getValidator() 方法
取得這個欄位的驗證函式,如果未設定,則為空值。如果未設定變數,則會傳回 null,因為驗證器不應在初始 setValue 呼叫時執行,因為此時欄位不會附加至區塊和工作區。
Signature:
getValidator(): FieldVariableValidator | null;
傳回:
FieldVariableValidator | null
驗證函式,或空值。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-09 (世界標準時間)。
[null,null,["上次更新時間:2024-11-09 (世界標準時間)。"],[[["The `getValidator()` method retrieves the validation function associated with a FieldVariable, which determines if a variable assignment is valid."],["It returns `null` if the variable isn't set or if the validation function hasn't been assigned, preventing validation during initial value setting."],["The returned validation function, if present, is of the `FieldVariableValidator` type and will be executed when variable assignments occur."]]],[]]