@blossom-carousel/vue
Version:
A native-scroll-first carousel component for Vue.
45 lines (44 loc) • 1.07 kB
JavaScript
import { shallowRef as l, onMounted as u, onBeforeUnmount as i, createBlock as c, openBlock as d, resolveDynamicComponent as m, withCtx as f, renderSlot as p } from "vue";
const y = {
__name: "BlossomCarousel",
props: {
as: {
type: String,
default: "div"
},
// repeat: {
// type: Boolean,
// default: false,
// },
load: {
type: String,
default: "conditional"
}
},
setup(t, { expose: a }) {
const r = t, e = l(null);
a({ el: e });
let o = null;
return u(async () => {
if (!window.matchMedia(
"(hover: hover) and (pointer: fine)"
).matches && r.load !== "always") return;
const { Blossom: n } = await import("@blossom-carousel/core");
o = n(e.value), o.init();
}), i(() => {
o == null || o.destroy();
}), (s, n) => (d(), c(m(t.as), {
ref_key: "root",
ref: e,
"blossom-carousel": "true"
}, {
default: f(() => [
p(s.$slots, "default")
]),
_: 3
}, 512));
}
};
export {
y as BlossomCarousel
};