mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore(Sticky): avoid repeated observe
This commit is contained in:
parent
0712d92063
commit
37a38c887f
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user