vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
62 lines (61 loc) • 2.16 kB
JavaScript
import { defineComponent as g, createElementBlock as i, openBlock as s, createVNode as a, createElementVNode as r, Transition as v, withCtx as w, unref as o, withModifiers as f } from "vue";
import { useImagePreview as h } from "./hook/useImagePreview.mjs";
import { Icon as u } from "@vuux/icons";
const x = { class: "image-preview-wrap" }, k = ["src"], E = {
key: 1,
class: "is-error"
}, I = /* @__PURE__ */ g({
__name: "index",
props: {
imgUrl: {}
},
emits: ["close"],
setup(n, { emit: c }) {
const d = c, { hasError: p, handleClose: l, handleError: m } = h(d);
return (_, e) => (s(), i("div", x, [
a(v, {
name: "ease",
appear: ""
}, {
default: w(() => [
!o(p) && n.imgUrl ? (s(), i("img", {
key: 0,
src: n.imgUrl,
onError: e[0] || (e[0] = //@ts-ignore
(...t) => o(m) && o(m)(...t))
}, null, 40, k)) : (s(), i("div", E, [...e[2] || (e[2] = [
r("svg", {
viewBox: "0 0 1024 1024",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
width: "80",
height: "80",
fill: "var(--app-text-color)"
}, [
r("path", { d: "M943.603 758.91c22.033 29.016 1.378 70.721-35.016 70.721h-793.18c-36.098 0-56.852-41.116-35.41-70.23l161.016-218.263c17.606-23.804 53.213-23.804 70.821 0L405.57 668.22l204.689-257.016c17.902-22.427 52.033-22.033 69.345 0.786l263.999 346.919v0.001zM359.34 455.075c-48.59 0-88.032-39.444-88.032-88.131 0-48.689 39.442-88.131 88.032-88.131 48.591 0 88.034 39.442 88.034 88.131 0 48.687-39.345 88.131-88.034 88.131z" })
], -1),
r("p", null, "图像加载失败", -1)
])]))
]),
_: 1
}),
r("div", {
class: "is-close",
onClick: e[1] || (e[1] = f(
//@ts-ignore
(...t) => o(l) && o(l)(...t),
["stop"]
))
}, [
a(o(u), {
name: "Icon9176904",
size: 18,
color: "rgba(255, 255, 255, 0.9)"
})
])
]));
}
});
export {
I as default
};