UNPKG

@zhsz/cool-design-dv

Version:

77 lines (76 loc) 2.48 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const vue = require("vue"); require("animate.css"); const index$1 = require("../dv-box/index.js"); const index = require("../../symbols/index.js"); const __default__ = vue.defineComponent({ name: "DvScreen", inheritAttrs: false }); const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, props: { enter: { type: String, default: "slideInRight" }, leave: { type: String, default: "slideOutLeft" } }, setup(__props) { const props = __props; const page = vue.inject(index.dvPageSymbols, null); const enterClass = vue.computed(() => { return `animate__animated animate__${props.enter} animate__faster`; }); const leaveClass = vue.computed(() => { return `animate__animated animate__${props.leave} animate__faster`; }); const instance = vue.getCurrentInstance(); const active = vue.computed(() => { if (!page) { return false; } return page.screens.value[page.screenActiveIndex.value] === (instance == null ? void 0 : instance.uid); }); function register() { if (page && (instance == null ? void 0 : instance.uid)) { page.screens.value.push(instance == null ? void 0 : instance.uid); } } function unregister() { if (page && (instance == null ? void 0 : instance.uid)) { page.screens.value = page.screens.value.filter((n) => n !== (instance == null ? void 0 : instance.uid)); } } register(); vue.onBeforeUnmount(() => { unregister(); }); return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(vue.Transition, { "enter-active-class": enterClass.value, "leave-active-class": leaveClass.value }, { default: vue.withCtx(() => [ active.value ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.default), vue.mergeProps({ key: 0, class: "my-dv-screen", "default-width": "100%", "default-height": "100%" }, _ctx.$attrs), { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16)) : vue.createCommentVNode("", true) ]), _: 3 }, 8, ["enter-active-class", "leave-active-class"]); }; } }); exports.default = _sfc_main;