UNPKG

comic-plus

Version:

<p align="center"> <img width="200px" src="./logo.png"/> </p>

89 lines (88 loc) 2.99 kB
import { defineComponent, ref, computed, watch, provide, openBlock, createElementBlock, createElementVNode, renderSlot, toDisplayString, unref, createVNode, createSlots, withCtx } from "vue"; import "../style/schedule.css"; import _sfc_main$2 from "./calendar.vue.mjs"; import _sfc_main$1 from "./content.vue.mjs"; import { SCHEDULE_PROVIDE } from "./type.mjs"; import { scheduleProps, scheduleEmits } from "./main.props.mjs"; import "../../../utils/config.mjs"; import { formatDate } from "../../../utils/tools.mjs"; import { isNumber } from "../../../utils/typescript.mjs"; import "@vueuse/core"; const _hoisted_1 = { class: "cu-schedule" }; const _hoisted_2 = { class: "cu-schedule-header" }; const _hoisted_3 = { class: "cu-schedule-header__time" }; const _hoisted_4 = { class: "cu-schedule--flexbox" }; const _sfc_main = /* @__PURE__ */ defineComponent({ ...{ name: "CuSchedule" }, __name: "main", props: scheduleProps, emits: scheduleEmits, setup(__props, { expose: __expose, emit: __emit }) { const props = __props; const emit = __emit; const date = ref(/* @__PURE__ */ new Date()); const calendarRef = ref(); const spacing = computed(() => { return isNumber(props.gap) ? Math.max(props.gap, 50) : 100; }); watch(date, (val) => { emit("changeDate", val); }); provide(SCHEDULE_PROVIDE, { date, props, spacing }); function selectDate(value) { var _a; (_a = calendarRef.value) == null ? void 0 : _a.selectDate(value); } __expose({ selectDate }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ renderSlot(_ctx.$slots, "header", { date: date.value }, () => [ createElementVNode("div", _hoisted_3, toDisplayString(unref(formatDate)(date.value, "yyyy年MM月dd日")), 1) ]) ]), createElementVNode("div", _hoisted_4, [ createVNode(_sfc_main$1, null, createSlots({ _: 2 }, [ _ctx.$slots.card ? { name: "card", fn: withCtx(({ data }) => [ renderSlot(_ctx.$slots, "card", { data }) ]), key: "0" } : void 0, _ctx.$slots.empty ? { name: "empty", fn: withCtx(({ date: date2 }) => [ renderSlot(_ctx.$slots, "empty", { date: date2 }) ]), key: "1" } : void 0 ]), 1024), createVNode(_sfc_main$2, { ref_key: "calendarRef", ref: calendarRef }, createSlots({ _: 2 }, [ _ctx.$slots.calendar ? { name: "calendar", fn: withCtx(() => [ renderSlot(_ctx.$slots, "calendar") ]), key: "0" } : void 0 ]), 1536) ]) ]); }; } }); export { _sfc_main as default };