blockly > FieldNumber > setConstraints

FieldNumber.setConstraints() 方法

設定這個欄位的最大值、最小值和精確度限制。這些屬性可能未定義或已停用 NaN。設定精確度 (通常為 10 的次方) 會強制執行值之間的最小步驟。也就是說,使用者的值會四捨五入至最接近的精確度倍數。最小位數位置是從精確度推斷而得。選擇整數精確度可以強制執行整數值。

Signature:

setConstraints(min: number | string | undefined | null, max: number | string | undefined | null, precision: number | string | undefined | null): void;

參數

參數 類型 說明
分鐘 number | string | undefined | null 最小值。
最高 number | string | undefined | null 最大值。
precision number | string | undefined | null 值的精確度。

傳回:

void