UNPKG

vue-files-preview-inno

Version:

A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.

54 lines (53 loc) 1.46 kB
import { defineComponent as a, ref as c, watch as l, openBlock as f, createElementBlock as m, createVNode as p, unref as h } from "vue"; import x from "../../../../node_modules/@vue-office/excel/lib/v3/index.mjs"; /* empty css */ import { getFileRenderByFile as v, getFileRenderByUrl as O } from "../../utils/utils.mjs"; const q = { class: "xlsx-preview" }, w = /* @__PURE__ */ a({ __name: "index", props: { file: { default: () => null }, url: { default: () => null }, name: {}, width: {}, height: {}, options: { default: () => ({}) }, requestOptions: { default: () => ({}) } }, emits: ["rendered", "error"], setup(r, { emit: s }) { const n = r, o = c(null); l( () => n.file, (e) => { e && v(e).then((t) => o.value = t); }, { immediate: !0 } ), l( () => n.url, (e) => { e && !n.file && O(e).then((t) => o.value = t); }, { immediate: !0 } ); const i = s; function d() { i("rendered"); } function u(e) { i("error", e); } return (e, t) => (f(), m("div", q, [ p(h(x), { src: o.value, options: r.options, requestOptions: r.requestOptions, onRendered: d, onError: u }, null, 8, ["src", "options", "requestOptions"]) ])); } }); export { w as default }; //# sourceMappingURL=index.vue2.mjs.map