mine-h5-ui
Version:
一款轻量级、模块化基于 Vue3.x 的 H5 前端 UI 组件库 👍
43 lines (42 loc) • 1.35 kB
JavaScript
import { defineComponent as f, openBlock as n, createElementBlock as r, unref as i, normalizeStyle as u } from "vue";
import { useImgEvent as h } from "./hooks.js";
const c = ["src", "alt"], w = /* @__PURE__ */ f({
name: "MeImg",
__name: "index",
props: {
src: {},
width: { default: "" },
height: { default: "" },
fill: { default: "" },
radius: { default: "0" },
alt: { default: "" }
},
emits: ["click", "load", "error"],
setup(t, { emit: m }) {
const s = m, { onClick: d, onLoad: a, onError: o } = h(s);
return (g, e) => (n(), r("div", {
class: "me-img",
onClick: e[2] || (e[2] = //@ts-ignore
(...l) => i(d) && i(d)(...l))
}, [
t.fill ? (n(), r("span", {
key: 1,
style: u(`width:${t.width};height:${t.height};border-radius:${t.radius};background:url(${t.src}) no-repeat center;background-size:${t.fill};`)
}, null, 4)) : (n(), r("img", {
key: 0,
src: t.src,
width: "40px",
height: "40px",
alt: t.alt,
style: u(`width:${t.width};height:${t.height};border-radius:${t.radius};`),
onLoad: e[0] || (e[0] = //@ts-ignore
(...l) => i(a) && i(a)(...l)),
onError: e[1] || (e[1] = //@ts-ignore
(...l) => i(o) && i(o)(...l))
}, null, 44, c))
]));
}
});
export {
w as default
};