UNPKG

tyh-ui2

Version:

The next generation ui component library of tyh-ui is based on vue3 Version, fully embrace vue3.

37 lines (36 loc) 1.16 kB
import { defineComponent as l, ref as i, openBlock as r, createElementBlock as o, renderSlot as d, normalizeClass as m, normalizeStyle as g, createElementVNode as h } from "vue"; import { Props as c } from "./index2.js"; const u = { class: "tyh-image" }, p = { key: 0, class: "tyh-image-error" }, y = /* @__PURE__ */ h("span", { class: "tyh-image-error-text" }, "\u52A0\u8F7D\u5931\u8D25", -1), f = ["draggable", "src", "alt"], _ = l({ name: "TyhImage" }), $ = /* @__PURE__ */ l({ ..._, props: c, emits: ["error", "load"], setup(v, { emit: t }) { const s = i(!1), n = () => { t("error"), s.value = !0; }; return (e, a) => (r(), o("div", u, [ s.value ? (r(), o("div", p, [ d(e.$slots, "error", {}, () => [ y ]) ])) : (r(), o("img", { key: 1, draggable: e.draggable, class: m([`tyh-image-${e.fit}`, { "tyh-image-select": e.select }]), style: g({ width: e.width, height: e.height }), src: e.src, alt: e.alt, onError: n, onLoad: a[0] || (a[0] = (k) => t("load")) }, null, 46, f)) ])); } }); export { $ as default };