fix(components): [number-input] cannot scroll the container when the mouse pointer over an input (#15211)

This commit is contained in:
dopamine 2024-02-04 11:06:39 +08:00 committed by GitHub
parent 73f4d0f57b
commit 9c9ebec0ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,7 +50,7 @@
:name="name"
:label="label"
:validate-event="false"
@wheel.prevent
@wheel="handleWheel"
@keydown.up.prevent="increase"
@keydown.down.prevent="decrease"
@blur="handleBlur"
@ -288,6 +288,10 @@ const setCurrentValueToModelValue = () => {
data.currentValue = props.modelValue
}
}
const handleWheel = (e: MouseEvent) => {
if (document.activeElement === e.target) e.preventDefault()
}
watch(
() => props.modelValue,
(value, oldValue) => {