mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
fix(Stepper): 修复 blur 事件触发异常 (#8620)
* fix(Stepper): 修复blur事件触发异常 * Update index.spec.ts
This commit is contained in:
parent
ed3dbd969d
commit
cee662f1d8
@ -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;
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user