vue-files-preview-inno
Version:
A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.
56 lines (55 loc) • 1.46 kB
JavaScript
import { defineComponent as c, ref as a, watch as l, openBlock as f, createElementBlock as m, createVNode as p, unref as h } from "vue";
import v from "../../../../node_modules/@vue-office/docx/lib/index.mjs";
/* empty css */
import { getFileRenderByFile as x, getFileRenderByUrl as O } from "../../utils/utils.mjs";
const q = { class: "docx-preview" }, g = /* @__PURE__ */ c({
__name: "index",
props: {
file: { default: () => null },
url: { default: () => null },
name: {},
options: { default: () => ({}) },
requestOptions: { default: () => ({}) }
},
emits: ["rendered", "error"],
setup(t, { emit: d }) {
const n = t, o = a(null);
l(
() => n.file,
(e) => {
e && x(e).then((r) => {
o.value = r;
});
},
{ immediate: !0 }
), l(
() => n.url,
(e) => {
e && !n.file && O(e).then((r) => {
o.value = r;
});
},
{ immediate: !0 }
);
const i = d;
function s() {
i("rendered");
}
function u(e) {
i("error", e);
}
return (e, r) => (f(), m("div", q, [
p(h(v), {
src: o.value,
options: t.options,
requestOptions: t.requestOptions,
onRendered: s,
onError: u
}, null, 8, ["src", "options", "requestOptions"])
]));
}
});
export {
g as default
};
//# sourceMappingURL=index.vue.mjs.map