UNPKG

@loickit-v/swiper

Version:

loickit swiper components for vue

64 lines (63 loc) 1.68 kB
import { defineComponent as f, ref as l, watch as c, onMounted as m, onBeforeUnmount as p, createElementBlock as u, openBlock as x, createElementVNode as I, renderSlot as h } from "vue"; import { useSlideState as v } from "../Provide/index.js"; import { useSlidePrivateState as S } from "../Slide/provide.js"; const R = /* @__PURE__ */ f({ name: "LSlideItem", __name: "index", props: { index: { default: 0 } }, setup(a) { const o = a, t = S(), n = v(t.name), r = l(), s = l(); n.infinite && c( () => n.currentIndex, () => { var e; n.currentIndex <= o.index + 1 && n.currentIndex >= o.index - 1 ? (e = r.value) == null || e.appendChild( t.itemsInfo[o.index].el ) : s.value.remove(); } ); const i = { index: o.index }; return m(() => { var d; const e = (d = r.value) == null ? void 0 : d.getBoundingClientRect(); i.width = e.width, i.height = e.height, n.infinite && (i.el = s.value), t.itemsInfo.push(i); }), p(() => { t.itemsInfo.splice( t.itemsInfo.indexOf(i), 1 ); }), (e, d) => (x(), u( "div", { ref_key: "slideItemRef", ref: r, class: "loickit-slide-item", style: { position: "relative" } }, [ I( "div", { ref_key: "slideItemContentWrapperRef", ref: s, class: "loickit-slide-item-content-wrapper" }, [ h(e.$slots, "default") ], 512 /* NEED_PATCH */ ) ], 512 /* NEED_PATCH */ )); } }); export { R as default };