From de625a14030bf61bd6b59f630c8f27c506bf09f4 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Fri, 11 Jul 2025 06:16:29 +0800 Subject: [PATCH] feat(components): [input-number] change the min and max default value (#21302) * feat(components): [input-number] change the min and max default value * docs: update --- docs/en-US/component/input-number.md | 42 +++++++++---------- .../input-number/src/input-number.ts | 4 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/en-US/component/input-number.md b/docs/en-US/component/input-number.md index 9ede6efe26..94317ce6c7 100644 --- a/docs/en-US/component/input-number.md +++ b/docs/en-US/component/input-number.md @@ -99,27 +99,27 @@ input-number/with-prefix-suffix ### Attributes -| Name | Description | Type | Default | -| --------------------------- | ------------------------------------------------ | --------------------------------------------- | --------- | -| model-value / v-model | binding value | ^[number] / ^[null] | — | -| min | the minimum allowed value | ^[number] | -Infinity | -| max | the maximum allowed value | ^[number] | Infinity | -| step | incremental step | ^[number] | 1 | -| step-strictly | whether input value can only be multiple of step | ^[boolean] | false | -| precision | precision of input value | ^[number] | — | -| size | size of the component | ^[enum]`'large' \| 'default' \| 'small'` | default | -| readonly ^(2.2.16) | same as `readonly` in native input | ^[boolean] | false | -| disabled | whether the component is disabled | ^[boolean] | false | -| controls | whether to enable the control buttons | ^[boolean] | true | -| controls-position | position of the control buttons | ^[enum]`'' \| 'right'` | — | -| name | same as `name` in native input | ^[string] | — | -| aria-label ^(a11y) ^(2.7.2) | same as `aria-label` in native input | ^[string] | — | -| placeholder | same as `placeholder` in native input | ^[string] | — | -| id | same as `id` in native input | ^[string] | — | -| value-on-clear ^(2.2.0) | value should be set when input box is cleared | ^[number] / ^[null] / ^[enum]`'min' \| 'max'` | — | -| validate-event | whether to trigger form validation | ^[boolean] | true | -| label ^(a11y) ^(deprecated) | same as `aria-label` in native input | ^[string] | — | -| inputmode ^(2.10.3) | same as `inputmode` in native input | ^[string] | — | +| Name | Description | Type | Default | +| --------------------------- | ------------------------------------------------ | --------------------------------------------- | ----------------------- | +| model-value / v-model | binding value | ^[number] / ^[null] | — | +| min | the minimum allowed value | ^[number] | Number.MAX_SAFE_INTEGER | +| max | the maximum allowed value | ^[number] | Number.MIN_SAFE_INTEGER | +| step | incremental step | ^[number] | 1 | +| step-strictly | whether input value can only be multiple of step | ^[boolean] | false | +| precision | precision of input value | ^[number] | — | +| size | size of the component | ^[enum]`'large' \| 'default' \| 'small'` | default | +| readonly ^(2.2.16) | same as `readonly` in native input | ^[boolean] | false | +| disabled | whether the component is disabled | ^[boolean] | false | +| controls | whether to enable the control buttons | ^[boolean] | true | +| controls-position | position of the control buttons | ^[enum]`'' \| 'right'` | — | +| name | same as `name` in native input | ^[string] | — | +| aria-label ^(a11y) ^(2.7.2) | same as `aria-label` in native input | ^[string] | — | +| placeholder | same as `placeholder` in native input | ^[string] | — | +| id | same as `id` in native input | ^[string] | — | +| value-on-clear ^(2.2.0) | value should be set when input box is cleared | ^[number] / ^[null] / ^[enum]`'min' \| 'max'` | — | +| validate-event | whether to trigger form validation | ^[boolean] | true | +| label ^(a11y) ^(deprecated) | same as `aria-label` in native input | ^[string] | — | +| inputmode ^(2.10.3) | same as `inputmode` in native input | ^[string] | — | ### Slots diff --git a/packages/components/input-number/src/input-number.ts b/packages/components/input-number/src/input-number.ts index 34c10a3027..a4f4af7ef1 100644 --- a/packages/components/input-number/src/input-number.ts +++ b/packages/components/input-number/src/input-number.ts @@ -38,14 +38,14 @@ export const inputNumberProps = buildProps({ */ max: { type: Number, - default: Number.POSITIVE_INFINITY, + default: Number.MAX_SAFE_INTEGER, }, /** * @description the minimum allowed value */ min: { type: Number, - default: Number.NEGATIVE_INFINITY, + default: Number.MIN_SAFE_INTEGER, }, /** * @description binding value