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 | 最大值。 |
精确率 | number | string | undefined | null | 值的精确率。 |
返回:
void