透過集合功能整理內容
你可以依據偏好儲存及分類內容。
封鎖 >FieldNumber >setConstraints
FieldNumber.setConstraints() 方法
請為這個欄位設定最大、最小和精確度限制條件。您可以將其中的任一屬性設為未定義,或是停用 NaN。設定精確度 (通常為 10 的次方) 會在值之間強制執行最少的步驟。也就是將使用者值四捨五入至最接近的精確度的倍數。系統會從精確度推斷出最小有效位數。如要強制執行整數值,請選擇整數精確度。
Signature:
setConstraints(min: number | string | undefined | null, max: number | string | undefined | null, precision: number | string | undefined | null): void;
參數
參數 |
類型 |
說明 |
分鐘 |
數字 |字串 |未定義 |空值 |
最小值。 |
最高 |
數字 |字串 |未定義 |空值 |
最大值。 |
精確性 |
數字 |字串 |未定義 |空值 |
值的精確度。 |
傳回:
void
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-25 (世界標準時間)。"],[],["The `setConstraints` method in `FieldNumber` sets constraints for a numeric field. It accepts `min`, `max`, and `precision` as parameters, which define the minimum allowed value, the maximum allowed value, and the value precision, respectively. These parameters can be numbers, strings, undefined, or null. Precision enforces a minimum step, rounding the user's input to the nearest multiple. Any constraint can be disabled by setting it to undefined or NaN. The method returns nothing.\n"]]