feat: 微客宝H5客户端 - 基础架构+核心页面

This commit is contained in:
li
2026-03-14 19:44:03 +08:00
parent 54d2f617bb
commit 0e974da09c
3738 changed files with 811180 additions and 21 deletions
+30
View File
@@ -0,0 +1,30 @@
import { inBrowser } from "../utils/index.mjs";
import { onDeactivated, onBeforeUnmount } from "vue";
import { onMountedOrActivated } from "@vant/use";
function useVisibilityChange(target, onChange) {
if (!inBrowser || !window.IntersectionObserver) {
return;
}
const observer = new IntersectionObserver(
(entries) => {
onChange(entries[0].intersectionRatio > 0);
},
{ root: document.body }
);
const observe = () => {
if (target.value) {
observer.observe(target.value);
}
};
const unobserve = () => {
if (target.value) {
observer.unobserve(target.value);
}
};
onDeactivated(unobserve);
onBeforeUnmount(unobserve);
onMountedOrActivated(observe);
}
export {
useVisibilityChange
};