mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 11:54:02 +00:00
chore(Sticky): avoid repeated observe
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import { inBrowser } from '../utils';
|
||||
import {
|
||||
Ref,
|
||||
onMounted,
|
||||
onActivated,
|
||||
onDeactivated,
|
||||
onBeforeUnmount,
|
||||
} from 'vue';
|
||||
import { Ref, onDeactivated, onBeforeUnmount } from 'vue';
|
||||
import { onMountedOrActivated } from '@vant/use';
|
||||
|
||||
// @Experimental
|
||||
export function useVisibilityChange(
|
||||
@@ -37,8 +32,7 @@ export function useVisibilityChange(
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(observe);
|
||||
onActivated(observe);
|
||||
onDeactivated(unobserve);
|
||||
onBeforeUnmount(unobserve);
|
||||
onMountedOrActivated(observe);
|
||||
}
|
||||
|
Reference in New Issue
Block a user