diff --git a/packages/input/src/input.ts b/packages/input/src/input.ts index 615f73a0..ac4d1a9a 100644 --- a/packages/input/src/input.ts +++ b/packages/input/src/input.ts @@ -73,6 +73,10 @@ export default defineComponent({ type: [String, Number] as PropType, default: null }, + wheel: { + type: [String, Number] as PropType, + default: () => getConfig().input.wheel ?? true + }, step: [String, Number] as PropType, trim: { type: Boolean as PropType, @@ -1295,7 +1299,7 @@ export default defineComponent({ const wheelEvent = (evnt: WheelEvent) => { const isNumType = computeIsNumType.value - if (isNumType && props.controls) { + if (isNumType && props.controls && props.wheel) { if (reactData.isActivated) { const delta = evnt.deltaY if (delta > 0) { diff --git a/packages/number-input/src/number-input.ts b/packages/number-input/src/number-input.ts index 4ad8b156..e61b266f 100644 --- a/packages/number-input/src/number-input.ts +++ b/packages/number-input/src/number-input.ts @@ -59,6 +59,10 @@ export default defineComponent({ type: [String, Number] as PropType, default: null }, + wheel: { + type: Boolean as PropType, + default: () => getConfig().numberInput.wheel ?? true + }, step: [String, Number] as PropType, exponential: { type: Boolean as PropType, @@ -646,7 +650,7 @@ export default defineComponent({ wheelDelta: number; }) => { const inputReadonly = computeInputReadonly.value - if (props.controls && !inputReadonly) { + if (props.controls && !inputReadonly && props.wheel) { if (reactData.isActivated) { evnt.stopPropagation() evnt.preventDefault() diff --git a/types/components/input.d.ts b/types/components/input.d.ts index 7d1fe4a1..5fbded6d 100644 --- a/types/components/input.d.ts +++ b/types/components/input.d.ts @@ -47,6 +47,7 @@ export namespace VxeInputPropTypes { export type Form = string export type Min = string | number export type Max = string | number + export type Wheel = boolean export type Step = string | number export type Trim = boolean export type Exponential = boolean @@ -108,6 +109,7 @@ export interface VxeInputProps { // number、integer、float min?: VxeInputPropTypes.Min max?: VxeInputPropTypes.Max + wheel?: VxeInputPropTypes.Wheel step?: VxeInputPropTypes.Step trim?: VxeInputPropTypes.Trim exponential?: VxeInputPropTypes.Exponential diff --git a/types/components/number-input.d.ts b/types/components/number-input.d.ts index 4e62a581..6bf4a9a3 100644 --- a/types/components/number-input.d.ts +++ b/types/components/number-input.d.ts @@ -40,6 +40,7 @@ export namespace VxeNumberInputPropTypes { export type Form = string export type Min = string | number export type Max = string | number + export type Wheel = boolean export type Step = string | number export type Exponential = boolean export type Controls = boolean @@ -84,6 +85,7 @@ export interface VxeNumberInputProps { // number、integer、float min?: VxeNumberInputPropTypes.Min max?: VxeNumberInputPropTypes.Max + wheel?: VxeNumberInputPropTypes.Wheel step?: VxeNumberInputPropTypes.Step exponential?: VxeNumberInputPropTypes.Exponential