UNPKG

yanzhen-design-vue

Version:

55 lines (54 loc) 1.95 kB
import { defineComponent, unref, openBlock, createBlock, normalizeClass, withCtx, mergeProps, createCommentVNode } from "vue"; import { Flex } from "ant-design-vue"; import "../../text-preview/index.mjs"; import "./upload-file-preview.vue.mjs"; import "./upload-image-preview.vue.mjs"; import { uploadPreviewName, uploadProps, uploadEmits, uploadOptions } from "./upload.mjs"; import { useUploadPreview } from "./use-upload-preview.mjs"; import { textPreviewProps, textPreviewEmits } from "../../text-preview/src/text-preview.mjs"; import _sfc_main$1 from "./upload-image-preview.vue2.mjs"; import _sfc_main$2 from "./upload-file-preview.vue2.mjs"; const _sfc_main = /* @__PURE__ */ defineComponent({ ...{ name: uploadPreviewName, inheritAttrs: true }, __name: "upload-preview", props: { ...uploadProps, ...textPreviewProps }, emits: { ...uploadEmits, ...textPreviewEmits }, setup(__props, { expose: __expose, emit: __emit }) { const ns = uploadOptions.ns; const props = __props; const emit = __emit; const { fileListRef, isImageType, exposeCtx, filePreviewRef, imagePreviewRef } = useUploadPreview( props, emit ); __expose(exposeCtx); return (_ctx, _cache) => { return unref(fileListRef).length > 0 ? (openBlock(), createBlock(unref(Flex), { key: 0, class: normalizeClass(unref(ns).b("preview")) }, { default: withCtx(() => [ unref(isImageType) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({ key: 0, ref_key: "imagePreviewRef", ref: imagePreviewRef }, props), null, 16)) : (openBlock(), createBlock(_sfc_main$2, mergeProps({ key: 1, ref_key: "filePreviewRef", ref: filePreviewRef }, props), null, 16)) ]), _: 1 }, 8, ["class"])) : createCommentVNode("", true); }; } }); export { _sfc_main as default };