mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-09 14:09:45 +08:00
perf(Swipe): avoid repeated initialization
This commit is contained in:
parent
704a9e3231
commit
c9417341e0
@ -3,8 +3,6 @@ import {
|
|||||||
watch,
|
watch,
|
||||||
reactive,
|
reactive,
|
||||||
computed,
|
computed,
|
||||||
onMounted,
|
|
||||||
onActivated,
|
|
||||||
onDeactivated,
|
onDeactivated,
|
||||||
onBeforeUnmount,
|
onBeforeUnmount,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
@ -19,6 +17,7 @@ import {
|
|||||||
useChildren,
|
useChildren,
|
||||||
useWindowSize,
|
useWindowSize,
|
||||||
usePageVisibility,
|
usePageVisibility,
|
||||||
|
onMountedOrActivated,
|
||||||
} from '@vant/use';
|
} from '@vant/use';
|
||||||
import { useTouch } from '../composition/use-touch';
|
import { useTouch } from '../composition/use-touch';
|
||||||
import { useExpose } from '../composition/use-expose';
|
import { useExpose } from '../composition/use-expose';
|
||||||
@ -398,10 +397,9 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(initialize);
|
|
||||||
onActivated(initialize);
|
|
||||||
onDeactivated(stopAutoplay);
|
onDeactivated(stopAutoplay);
|
||||||
onBeforeUnmount(stopAutoplay);
|
onBeforeUnmount(stopAutoplay);
|
||||||
|
onMountedOrActivated(initialize);
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div ref={root} class={bem()}>
|
<div ref={root} class={bem()}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user