tyh-ui2
Version:
The next generation ui component library of tyh-ui is based on vue3 Version, fully embrace vue3.
86 lines (85 loc) • 2.5 kB
JavaScript
import { defineComponent as c, getCurrentInstance as g, watch as k, openBlock as o, createBlock as C, Transition as v, withCtx as w, withDirectives as $, createElementVNode as r, normalizeClass as V, normalizeStyle as p, withModifiers as h, createElementBlock as s, renderSlot as a, toDisplayString as _, createCommentVNode as n, vShow as z } from "vue";
import { Props as B } from "./index2.js";
const S = ["onClick"], T = {
key: 0,
class: "tyh-dialog-header"
}, D = {
key: 0,
class: "tyh-dialog-title"
}, E = {
key: 1,
class: "tyh-dialog-title"
}, I = ["onClick"], b = {
key: 1,
class: "tyh-dialog-body"
}, A = {
key: 2,
class: "tyh-dialog-footer"
}, N = c({
name: "TyhDialog"
}), L = /* @__PURE__ */ c({
...N,
props: B,
emits: [
"update:modelValue",
"open",
"close",
"onOpen",
"onClose"
],
setup(y, { emit: l }) {
const i = y, d = () => {
l("close"), l("update:modelValue", !1);
}, u = () => {
!i.modalClose || d();
}, { proxy: f } = g();
return k(
() => i.modelValue,
(e) => {
e && l("open");
const t = f.$el;
e && i.appendToBody && document.body.appendChild(t);
}
), (e, t) => (o(), C(v, {
name: "tyh-dialog",
onAfterEnter: t[0] || (t[0] = (m) => l("onOpen")),
onAfterLeave: t[1] || (t[1] = (m) => l("onClose"))
}, {
default: w(() => [
$(r("div", {
class: V(["tyh-dialog-packing", { "tyh-dialog-modal": e.modal }]),
style: p({ zIndex: e.zIndex }),
onClick: h(u, ["self"])
}, [
r("div", {
class: "tyh-dialog",
style: p({ width: e.width, marginTop: e.top })
}, [
e.showHeader ? (o(), s("div", T, [
e.$slots.title ? (o(), s("span", D, [
a(e.$slots, "title")
])) : (o(), s("span", E, _(e.title), 1)),
e.showClose ? (o(), s("i", {
key: 2,
class: "tyh-icon tyh-ui-close",
onClick: h(d, ["stop"])
}, null, 8, I)) : n("", !0)
])) : n("", !0),
e.$slots.default ? (o(), s("div", b, [
a(e.$slots, "default")
])) : n("", !0),
e.$slots.footer ? (o(), s("div", A, [
a(e.$slots, "footer")
])) : n("", !0)
], 4)
], 14, S), [
[z, e.modelValue]
])
]),
_: 3
}));
}
});
export {
L as default
};