From 0f06cb2303cde393f8878321e655dd7a5765f588 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Thu, 24 Dec 2020 21:01:52 +0800 Subject: [PATCH] fix(Swipe): incorrect active tab when activated #7772 --- src/swipe/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/swipe/index.js b/src/swipe/index.js index 4cf5087dd..317238c41 100644 --- a/src/swipe/index.js +++ b/src/swipe/index.js @@ -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 () => (