tyh-ui2
Version:
The next generation ui component library of tyh-ui is based on vue3 Version, fully embrace vue3.
56 lines (55 loc) • 1.72 kB
JavaScript
import { defineComponent as u, ref as d, getCurrentInstance as f, computed as g, openBlock as s, createBlock as v, Transition as C, withCtx as k, withDirectives as w, createElementVNode as o, normalizeClass as n, unref as S, normalizeStyle as T, createElementBlock as c, createCommentVNode as m, toDisplayString as _, vShow as $ } from "vue";
import { Props as B } from "./index2.js";
const E = { class: "tyh-message-content" }, z = u({
name: "TyhMessage"
}), A = /* @__PURE__ */ u({
...z,
props: B,
setup(p) {
const t = p, a = d(!0);
let l;
t.time > 0 && (l = setTimeout(() => {
r();
}, t.time));
const r = () => {
clearTimeout(l), a.value = !1;
}, i = f(), h = () => {
i.vnode.el.parentElement.removeChild(i.vnode.el);
}, y = g(() => [
"tyh-message",
`tyh-message-${t.type}`,
{ "tyh-message-round": t.round }
]);
return (e, D) => (s(), v(C, {
name: "tyh-message-fade",
appear: "",
onAfterLeave: h
}, {
default: k(() => [
w(o("div", {
class: n(S(y)),
style: T({ top: `${e.offset}px` })
}, [
o("div", E, [
e.icon ? (s(), c("i", {
key: 0,
class: n(["tyh-icon", "lef-icon", e.icon, `tyh-message-${e.type}`])
}, null, 2)) : m("", !0),
o("span", null, _(e.message), 1),
e.showClose ? (s(), c("i", {
key: 1,
class: n(["tyh-icon", "tyh-ui-close", `tyh-message-${e.type}`]),
onClick: r
}, null, 2)) : m("", !0)
])
], 6), [
[$, a.value]
])
]),
_: 1
}));
}
});
export {
A as default
};