@opensig/opendesign
Version:
<p align="center"><img src="../docs/public/opendesign-logo-light.png"/></p> <h1 align="center">opendesign</h1> <p align="center">一个 Vue 3 组件库</p> <p align="center"><b>皮肤可定制,使用 TypeScript</b></p>
23 lines (22 loc) • 832 B
JavaScript
;
const vue = require("vue");
const useElementIntersection = require("../hooks/use-element-intersection.js");
require("../_utils/global.js");
const intersectionObserver = vue.defineComponent({
name: "OIntersectionObserver",
emits: ["intersection"],
setup(_props, { emit, slots }) {
const { vIntersectionObserver } = useElementIntersection.useIntersectionObserverDirective({
listener: (entry) => {
emit("intersection", entry.isIntersecting, entry);
},
removeOnUnmounted: false
});
return () => {
var _a;
const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
return children == null ? void 0 : children.map((item) => vue.withDirectives(vue.cloneVNode(item), [[vIntersectionObserver]]));
};
}
});
module.exports = intersectionObserver;