1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-06 03:57:59 +08:00

fix(Swipe): incorrect active tab when activated

This commit is contained in:
chenjiahan 2020-12-24 21:01:52 +08:00
parent fc55822b48
commit 0f06cb2303

@ -3,6 +3,8 @@ import {
watch,
reactive,
computed,
onMounted,
onActivated,
onDeactivated,
onBeforeUnmount,
} from 'vue';
@ -17,7 +19,6 @@ import {
useChildren,
useWindowSize,
usePageVisibility,
onMountedOrActivated,
} from '@vant/use';
import { useTouch } from '../composables/use-touch';
import { useExpose } from '../composables/use-expose';
@ -397,9 +398,12 @@ export default createComponent({
}
});
onMounted(initialize);
onActivated(() => {
initialize(state.active);
});
onDeactivated(stopAutoplay);
onBeforeUnmount(stopAutoplay);
onMountedOrActivated(initialize);
return () => (
<div ref={root} class={bem()}>