diff --git a/src/stepper/Stepper.tsx b/src/stepper/Stepper.tsx index 14fae460a..c5beea081 100644 --- a/src/stepper/Stepper.tsx +++ b/src/stepper/Stepper.tsx @@ -1,4 +1,4 @@ -import { ref, watch, computed, PropType, defineComponent } from 'vue'; +import { ref, watch, computed, PropType, defineComponent, nextTick } from 'vue'; // Utils import { @@ -212,8 +212,10 @@ export default defineComponent({ const value = format(input.value); input.value = String(value); current.value = value; - emit('blur', event); - resetScroll(); + nextTick(() => { + emit('blur', event); + resetScroll(); + }) }; let isLongPress: boolean; diff --git a/src/stepper/test/index.spec.ts b/src/stepper/test/index.spec.ts index 6c9910370..35da88595 100644 --- a/src/stepper/test/index.spec.ts +++ b/src/stepper/test/index.spec.ts @@ -1,3 +1,4 @@ +import { nextTick } from 'vue'; import { Stepper } from '..'; import { mount, later } from '../../../test'; @@ -244,6 +245,7 @@ test('should format input value when stepper blured', async () => { await input.trigger('blur'); expect(wrapper.emitted('update:modelValue')![1]).toEqual([3]); + await nextTick(); expect(wrapper.emitted('blur')).toBeTruthy(); });