comic-plus
Version:
<p align="center"> <img width="200px" src="./logo.png"/> </p>
47 lines (46 loc) • 1.61 kB
JavaScript
import { defineComponent, computed, openBlock, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle } from "vue";
const _hoisted_1 = { class: "cu-calendar__schedules" };
const _hoisted_2 = ["onMouseenter"];
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "schedules",
props: {
data: Array,
day: Object
},
emits: ["mouse-in", "mouse-out"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const eventDay = computed(() => {
return props.data.find((v) => v.date.getTime() === props.day.date.getTime());
});
function getClasses(item) {
let classes = [];
if (item.startDate.getDate() === props.day.value) {
classes.push("is-start");
}
if (item.endDate.getDate() === props.day.value) {
classes.push("is-end");
}
return classes;
}
function mouseenter(item) {
emit("mouse-in", item);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("ul", _hoisted_1, [
(openBlock(true), createElementBlock(Fragment, null, renderList(eventDay.value.events, (item) => {
return openBlock(), createElementBlock("li", {
class: normalizeClass(getClasses(item)),
style: normalizeStyle({ background: item.color, marginTop: item.top + 4 + "px" }),
onMouseenter: ($event) => mouseenter(item),
onMouseleave: _cache[0] || (_cache[0] = ($event) => emit("mouse-out"))
}, null, 46, _hoisted_2);
}), 256))
]);
};
}
});
export {
_sfc_main as default
};