UNPKG

taos

Version:

TAOS - Tailwind CSS Animation on Scroll Library

38 lines (33 loc) 622 B
import { h, ref, defineComponent, onMounted, onBeforeUnmount } from "vue"; import { initElement, removeElement } from "./utils"; export const TAOS = defineComponent({ name: "TAOS", inheritAttrs: true, props: { as: { type: String, default: "div", }, }, setup(props) { const root = ref(null); onMounted(() => { initElement(root.value); }); onBeforeUnmount(() => { removeElement(root.value); }); return { root, }; }, render() { return h( this.as, { ref: "root", }, this.$slots.default?.() ); }, });