images-viewer-vue3
Version:
A lightweight image viewer for Vue3
31 lines (30 loc) • 1.39 kB
JavaScript
const c = "1.0.25", d = (e) => new Promise((a, t) => {
if (l(e) && e.length > 0) {
const [n, r] = e.reduce((o, i) => (i ? o[0].push(i) : o[1].push(i), o), [[], []]);
r.length && console.warn(`images-viewer-vue3:The image parameter 'images' contains illegal characters:[${JSON.stringify(r)}]`), a({ data: n });
} else a({ data: e });
}), s = () => {
var e = /* @__PURE__ */ new Date(), a = e.getFullYear(), t = e.getMonth() + 1, n = e.getDate(), r = e.getHours(), o = e.getMinutes(), i = e.getSeconds();
return `${a}${t}${n}_${r}${o}${i}`;
}, g = (e, a) => {
fetch(e).then((t) => t.blob()).then((t) => {
var n = document.createElement("a");
n.style.display = "none", document.body.appendChild(n);
var r = window.URL.createObjectURL(t);
n.href = r, n.download = s(), n.click(), window.URL.revokeObjectURL(r), document.body.removeChild(n);
});
}, u = () => {
const e = navigator.userAgent || navigator.vendor || window.opera, a = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(
e.toLowerCase()
);
let t = !1;
return a && (t = !0), ("ontouchstart" in window || navigator.maxTouchPoints > 0) && (t = !0), t;
}, l = (e) => Object.prototype.toString.call(e) === "[object Array]";
export {
d as asyncVerifyIllegalImage,
g as downloadExe,
s as getTimeStamp,
u as getUserAgent,
l as isTrueArray,
c as versions
};