chore(Sticky): avoid repeated observe

This commit is contained in:
chenjiahan 2020-11-11 22:45:34 +08:00
parent 0712d92063
commit 37a38c887f

View File

@ -1,11 +1,6 @@
import { inBrowser } from '../utils'; import { inBrowser } from '../utils';
import { import { Ref, onDeactivated, onBeforeUnmount } from 'vue';
Ref, import { onMountedOrActivated } from '@vant/use';
onMounted,
onActivated,
onDeactivated,
onBeforeUnmount,
} from 'vue';
// @Experimental // @Experimental
export function useVisibilityChange( export function useVisibilityChange(
@ -37,8 +32,7 @@ export function useVisibilityChange(
} }
}; };
onMounted(observe);
onActivated(observe);
onDeactivated(unobserve); onDeactivated(unobserve);
onBeforeUnmount(unobserve); onBeforeUnmount(unobserve);
onMountedOrActivated(observe);
} }