UNPKG

yuang-framework-ui-pc

Version:

yuang-framework-ui-pc Library

88 lines (87 loc) 2.58 kB
"use strict"; const vue = require("vue"); const elementPlus = require("element-plus"); const core = require("../utils/core"); const props = require("./props"); const _sfc_main = vue.defineComponent({ name: "EleImageViewer", components: { ElImageViewer: elementPlus.ElImageViewer }, props: props.imageViewerProps, emits: props.imageViewerEmits, setup(props2, { emit }) { const imageViewerRef = vue.ref(null); const viewerProps = vue.computed(() => { const options = core.omit(props2, [ "modelValue", "customClass", "customStyle", "transitionName", "keepAlive" ]); options.teleported = false; return options; }); const handleClose = () => { emit("update:modelValue", false); emit("close"); }; const handleSwitch = (index2) => { emit("switch", index2); }; const handleRotate = (deg) => { emit("rotate", deg); }; vue.onDeactivated(() => { handleClose(); }); return { imageViewerRef, viewerProps, handleClose, handleSwitch, handleRotate }; } }); const _export_sfc = (sfc, props2) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props2) { target[key] = val; } return target; }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_ElImageViewer = vue.resolveComponent("ElImageViewer"); return vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body", disabled: !_ctx.teleported }, [ vue.createVNode(vue.Transition, { name: _ctx.transitionName, appear: true }, { default: vue.withCtx(() => [ _ctx.modelValue ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: vue.normalizeClass(["ele-image-viewer", _ctx.customClass]), style: vue.normalizeStyle(_ctx.customStyle) }, [ vue.createVNode(_component_ElImageViewer, vue.mergeProps(_ctx.viewerProps, { ref: "imageViewerRef", onClose: _ctx.handleClose, onSwitch: _ctx.handleSwitch, onRotate: _ctx.handleRotate }), { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["onClose", "onSwitch", "onRotate"]) ], 6)) : vue.createCommentVNode("", true) ]), _: 3 }, 8, ["name"]) ], 8, ["disabled"]); } const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); module.exports = index;